[webkit-changes] cvs commit: WebCore/layout-tests/fast/encoding utf-16-no-bom-expected.txt utf-16-no-bom.xml

Darin darin at opensource.apple.com
Sat Sep 24 02:49:13 PDT 2005


darin       05/09/24 02:49:12

  Modified:    .        ChangeLog
               khtml/misc decoder.cpp
  Added:       layout-tests/fast/encoding utf-16-no-bom-expected.txt
                        utf-16-no-bom.xml
  Log:
          Reviewed and landed by Darin.
  
          - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5027
            Decoder doesn't auto-detect XML encoded as UTF-16 if BOM is not present
  
          Test cases added:
          * layout-tests/fast/encoding/utf-16-no-bom.xml: Added.
          * layout-tests/fast/encoding/utf-16-no-bom-expected.txt: Added.
  
          * khtml/misc/decoder.cpp: (Decoder::decode): Auto-detect an XML header with 16-bit characters
          (big or little endian) and decide encoding based on that.
  
  Revision  Changes    Path
  1.155     +14 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- ChangeLog	24 Sep 2005 06:29:06 -0000	1.154
  +++ ChangeLog	24 Sep 2005 09:49:10 -0000	1.155
  @@ -1,3 +1,17 @@
  +2005-09-24  Alexey Proskuryakov  <ap at nypop.com>
  +
  +        Reviewed and landed by Darin.
  +
  +        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5027
  +          Decoder doesn't auto-detect XML encoded as UTF-16 if BOM is not present
  +
  +        Test cases added:
  +        * layout-tests/fast/encoding/utf-16-no-bom.xml: Added.
  +        * layout-tests/fast/encoding/utf-16-no-bom-expected.txt: Added.
  +
  +        * khtml/misc/decoder.cpp: (Decoder::decode): Auto-detect an XML header with 16-bit characters
  +        (big or little endian) and decide encoding based on that.
  +
   2005-09-23  Eric Seidel  <eseidel at apple.com>
   
           No review, build fix only.
  
  
  
  1.44      +8 -0      WebCore/khtml/misc/decoder.cpp
  
  Index: decoder.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/decoder.cpp,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- decoder.cpp	15 Sep 2005 05:22:57 -0000	1.43
  +++ decoder.cpp	24 Sep 2005 09:49:11 -0000	1.44
  @@ -526,6 +526,14 @@
                           }
                           setEncoding("UTF-8", EncodingFromXMLHeader);
                           goto found;
  +                    } else if (ptr[0] == 0 && ptr[1] == '?' && ptr[2] == 0 && ptr[3] == 'x' && ptr[4] == 0 && ptr[5] == 'm' && ptr[6] == 0 && ptr[7] == 'l') {
  +                        // UTF-16 without BOM
  +#if APPLE_CHANGES
  +                        setEncoding(((ptr - buffer.latin1()) % 2) ? "UTF-16LE" : "UTF-16BE", AutoDetectedEncoding);
  +#else
  +                        setEncoding(((ptr - buffer.data()) % 2) ? "UTF-16LE" : "UTF-16BE", AutoDetectedEncoding);
  +#endif
  +                        goto found;
                       }
   
                       if(*ptr == '/') ptr++, end=true;
  
  
  
  1.1                  WebCore/layout-tests/fast/encoding/utf-16-no-bom-expected.txt
  
  Index: utf-16-no-bom-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x18
    RenderBlock {TEST} at (0,0) size 800x18
      RenderText {TEXT} at (0,0) size 455x18
        text run at (0,0) width 455: "Should be \"CYRILLIC SMALL LETTER IO\" (like e with diaeresis): \x{451}"
  
  
  
  1.1                  WebCore/layout-tests/fast/encoding/utf-16-no-bom.xml
  
  	<<Binary file>>
  
  



More information about the webkit-changes mailing list