Shoutbox

Character encoding of a file - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Character encoding of a file (/showthread.php?tid=91777)

Character encoding of a file by tribbium on 08-05-2009 at 02:28 PM

When opening a file, how can you determine what type of character encoding is being used?


RE: Character encoding of a file by Patchou on 08-05-2009 at 03:19 PM

Yes, just check the first coupel of bytes. For example, the first two bytes of a TFF-16 Unicode file will be 0xFF 0xFE. You can find all the specs you want for all the encoding kinds on the internet.

One thing though: if the file you try to open was simply recorded in an old multibyte format, then there's no header and you cannot know for sure without testing the file visually (I do that with IE myself as it lets you switch the encoding quickly).


RE: Character encoding of a file by tribbium on 08-05-2009 at 03:35 PM

thanks, I knew about the BOM but was worried that it may be missing. I expect people to be using notepad at any rate so it'll be fine.

thanks again