Flash XML parsing: win vs mac

    Simple and clear code:
    package {
      import flash.display.Sprite;
      
      public class XCDATATest extends Sprite {
        public function XCDATATest() {
          var node:XML =
           ds3 - CSV Settings:
    ignore_first_row=true
    columns_separator=;
    rows_separator=\n]]>
          
    ;
          trace (String(node));
        }
      }
    }

    * This source code was highlighted with Source Code Highlighter.

    It can lead to very “funny” consequences of different work of swf-ki under different systems.

    The source file for those who want to try: anychart.com/batsuev/habrahabr/xml-win-mac/XCDATATest.as
    Actually, whoever opens the file with the code will immediately guess what is the matter.
    (copy-paste from the article will not achieve this)

    And the fun actually lies in the fact that trace under the poppy will produce the following:
                  ds3 - CSV Settings:
    ignore_first_row=true
    columns_separator=;
    rows_separator=\n

    * This source code was highlighted with Source Code Highlighter.


    And under Win it will be like this:
    ds3 - CSV Settings:
    ignore_first_row=true
    columns_separator=;
    rows_separator=\n

    * This source code was highlighted with Source Code Highlighter.


    This difference in the operation of the 10th Flash Player under Win and Mac is that the magic character with the code 0xA0 (better known as nbsp) is ignored outside of CDATA under Win, but is perceived as significant under Mac.

    Be careful with invisible characters.

    PS : Visual Studio generated XML with this magic symbol after autoformatting

    Also popular now: