mIRC Home    About    Download    Register    News    Help

Print Thread
Writing characters 160 and above introduce #227268 03/11/10 03:35 AM
Joined: Nov 2009
Posts: 295
P
pball Online OP
Fjord artisan
OP Online
Fjord artisan
P
Joined: Nov 2009
Posts: 295
//write test.txt $chr(167) $+ hey $chr(171) $+ you $+ $chr(172)

in mirc 7.14 writes
§hey «you¬

in mirc 6.35
hey you


http://scripting.pball.win
My personal site with some scripts I've released.
Re: Writing characters 160 and above introduce [Re: pball] #227270 03/11/10 04:38 AM
Joined: Dec 2002
Posts: 339
D
drum Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
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) ?

Re: Writing characters 160 and above introduce [Re: drum] #227277 03/11/10 12:45 PM
Joined: Nov 2009
Posts: 295
P
pball Online OP
Fjord artisan
OP Online
Fjord artisan
P
Joined: Nov 2009
Posts: 295
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


http://scripting.pball.win
My personal site with some scripts I've released.
Re: Writing characters 160 and above introduce [Re: pball] #227282 03/11/10 02:50 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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.


Invision Support
#Invision on irc.irchighway.net
Re: Writing characters 160 and above introduce [Re: pball] #227304 04/11/10 01:07 AM
Joined: Dec 2002
Posts: 339
D
drum Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
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.