mIRC Homepage
Posted By: dabb Sending non UTF-8 encoded text from script? - 22/01/11 02:23 AM
Using mIRC 7.x, I'm having some issues with clients that don't support unicode. I use $chr(160) heavily in my scripts and it now sends \xc2\xa0.

From the script language, is there anyway to force /msg to send a message with no UTF-8 encoding? I disabled "UTF-8 encode/decode messages" from Options->IRC->Messages but it seems to have no effect. As a workaround, I tried using "/raw -n PRIVMSG :<msg>", but that still seems to be sending \xc2\xa0 for $chr(160).

Any ideas? Or is going back to 6.35 my only option?
According to the help file, your usage of the -n switch with the /raw command is the correct method.

I don't know if this was a typo or not, but I did notice that the /raw command you posted appeared to be missing a parameter.

You posted /raw -n PRIVMSG :<msg>
When I believe it should be /raw -n PRIVMSG <nickname> :<message>

As you can see, the line you posted is missing the <nickname> parameter.
$chr(160) should really NOT be used without UTF8. In UTF8, it will be a space for everyone who views it as UTF8, but without UTF8, it can be a variety of things depending on a user's code page. Rather than trying to use it where it's not always going to display the way you think it is, you should use something else instead. Just because you can see it as a space doesn't mean everyone does. For some, it will appear as a box, for others, it may appear as some other character. All depending on code pages. This is true even if you send that character from mIRC 6.35 or older (i.e. not encoded).

If all you're doing is putting in multiple spaces, there are other methods that will display correctly no matter who looks at them and no matter whether or not they are viewing it in UTF8.
Posted By: dabb Re: Sending non UTF-8 encoded text from script? - 22/01/11 05:57 PM
Originally Posted By: Riamus2
If all you're doing is putting in multiple spaces, there are other methods that will display correctly no matter who looks at them and no matter whether or not they are viewing it in UTF8.


I am putting out multiple spaces so columns of data always "line up" assuming a proportional font is being used. Please do tell what these other methods are. smile
There are a couple of options that come to mind. First is to use spaces.dll, which is designed to allow outputting multiple spaces. The other option is to use a CTRL code between spaces. If you don't need to keep colors/bold/underline/etc, then the best method would be using Ctrl-O... space Ctrl-O space Ctrl-O space. You can use $str() to repeat that as many times as you need. It does double the number of characters for each space, but unless you're using long lines, it's not a problem. And if you are aligning things, I doubt you're using long lines because wrapping would mess things up. If you do need to keep previous codes, then you can use double Ctrl-B or double Ctrl-U or whatever. That increases line length even more, but also works fine.

The use of CTRL codes work very well and are not seen except if someone tries to copy the line(s) holding CTRL or tries to read a log file somewhere that doesn't hide the CTRL code. The use of the DLL works even better as long as you don't mind using a DLL.
Posted By: dabb Re: Sending non UTF-8 encoded text from script? - 24/01/11 07:39 AM
spaces.dll works beautifully, thanks for the tip! I wish I had run across it a long time ago.
Hi,

In mIRC v6.35 Options \ IRC \ Messages you had "SJIS/JIS conversion, UTF-8 display, Multibyte display, Multibyte editbox,
Font linking, ANSI codes"
In mIRC v7.19 there is only "UTF-8 encode/decode messages".
On an UTF-8 server with most non UTF-8 users, I should decode UTF-8 but not encode. How can I do this now ?

a+, =)
-=Finiderire=-

Configuration : mIRC v7.19
There are many threads regarding the use of codepages. mIRC supports UTF8 now. If you want to use codepages, you will need to stick with 6.35. That or try to get people to start using UTF8. Just about every client out there supports it, so unless it's due to a server that won't support it, there is no reason not to start using UTF8.
Posted By: Wims Re: Sending non UTF-8 encoded text from script? - 30/04/11 03:19 AM
mirc has /raw -n, that do not encode in utf8 characters in the range 0-255, so you can keep "UTF-8 encode/decode messages" checked and use /raw -n to override mirc's default behavior when sending a message (halting on input)
© mIRC Discussion Forums