Menu

saving in utf8

2007-12-15
2012-11-13
  • Nobody/Anonymous

    Yo!

    When I save document in Notepad++ in utf8 charset it puts 3 chars in the beginning of document (files) (wiewed by integrated hex editor). These 3 chars make latex compiler stop working. I also tryed Notepad2 and saved in utf8, but there was no chars in the beginnning and latex compiled successfully. So why Notepad++ do these 3 chars?

     
    • Nobody/Anonymous

      Yes, but some file readers and web servers/browsers will completely Bomb-out and fail to read your file if it has a BOM.

      Not much good being 100%-pure when you get 100% pure not working.

       
    • Idris Samawi Hamid

      This is the BOM (byte-order mark) which marks the file as utf-8. In ConTeXt (which I use) this is recognized automatically. There must be some LaTeX package out there that enables a utf-8 regime as well.

      In any case the work around for LaTeX is to choose both

      Format>Encode in ANSI
      Format>UTF-8 without BOM

      Best wishes
      Idris

      PS For a 21st century TeX, check out ConTeXt. Soon luaTeX will be stable and then LaTeX will be fully utf-8 compliant.

       
    • Idris Samawi Hamid

      > I also tryed Notepad2 and saved in utf8,
      > but there was no chars in the beginnning

      Without the BOM, this is NOT officially recognized 100%-pure utf-8 ;-)

      Idris

      ==============
      Byte Order Mark, U+FEFF ZERO WIDTH NO-BREAK SPACE

      The character U+FEFF normally acts as a zero width non-breaking space. It can also be used as a byte order mark when it occurs as the first character in a file to detect the byte order of UTF-16 and UTF-32 files. If the byte order is reversed, the value FEFF(hex) appears as FFFE(hex), which is not a valid Unicode character. UniPad handles the byte order mark automatically.

      The byte order mark is also used as a signature to detect UTF-16 files, since the byte sequences FF FE or FE FF rarely occur in 8-bit text.

      The byte order mark is also used as a marker/signature to detect UTF-8 files since the byte sequence is EF BB BF rarely occur in other 8-bit character sets. The byte order is obviously not an issue here.

      The byte order mark is also used as a signature to detect UTF-32 files. The possible bytes sequences are either 00 00 FE FF or FF FE 00 00 (depending on byte order).

      The byte order mark can be used as a signature for the Standard Compression Scheme. The byte sequence is 0E FE FF.

      ©1997-2006 Sharmahd Computing