mIRC Homepage
Posted By: pball Writing characters 160 and above introduce  - 03/11/10 03:35 AM
//write test.txt $chr(167) $+ hey $chr(171) $+ you $+ $chr(172)

in mirc 7.14 writes
§hey «you¬

in mirc 6.35
§hey «you¬
It works fine for me. What version of Windows are you using, and what text editor are you using to view the contents of test.txt?

What do you get if you do $read(test.txt,1) ?
Windows 7

reading the file from mirc doesn't show the accented A
viewing in notepad doesn't show it

viewing in wordpad, firefox shows the accented A

I noticed the problem because I'm writing an html file and it appears when that page is viewed
You may not have your encoding set to Unicode in Firefox and Wordpad may also have some kind of similar setting. I don't use Wordpad, so I don't know for sure on that one.
OK, I see what's going on. Note that mIRC is writing to the file correctly, but mIRC does not add a byte order mark (BOM) to the beginning of the file. If no BOM is present, a text editor has to guess whether or not the file is Unicode or plain ASCII. In this case, Wordpad appears to be assuming that all text is plain ASCII unless it sees a BOM, while Notepad will use intelligent "guessing" if no BOM is present.

Depending on your application, you may or may not want a BOM in the file so I don't think it is a good idea for /write to automatically add it. If this is only a one-time issue where you need to add a BOM to the file, an easy way to do it is to just open the file in Notepad then save it, as Notepad will automatically add the BOM if it's not already present.
© mIRC Discussion Forums