mIRC Homepage
Posted By: argv0 Support base-16 in $chr() - 07/05/10 09:31 PM
Now that mIRC can represent $chr() values > 256 (Unicode codepoints) it would be a lot simpler and less confusing if those values could be represented in base-16, as this is the standard representation for Unicode codepoints (U+nnnn).

The following syntaxes would be beneficial to users:

//echo -a $chr(0x0E03)
//echo -a $chr(U+0E03)

The latter syntax being the standard Unicode codepoint notation. This would make it easier for users to copy paste these codepoints out of programs like charmap.exe and websites like these.
Posted By: FroggieDaFrog Re: Support base-16 in $chr() - 07/05/10 10:04 PM
$char($base(#,16,10)) ^.^
Posted By: argv0 Re: Support base-16 in $chr() - 07/05/10 10:09 PM
Knowing when to and when not to do base conversion is the problem.

Most users would assume: U+0155 == $chr(155). They would be wrong.

This is actually further muddled by the fact that Windows Alt+NNNN codes are represented in base10 but U+NNNN codes are base16.

So a user might think Alt+0155 == U+0155. They would be wrong about that too.
Posted By: FroggieDaFrog Re: Support base-16 in $chr() - 07/05/10 10:55 PM
yea. But those fooling around with unicode generally know that alt+155 != U+0155 -shrugs- I do see where u are coming from, but instead of having $chr(u...) have $uchr(...)
Posted By: qwerty Re: Support base-16 in $chr() - 07/05/10 10:57 PM
Agreed, that would be very handy.
Posted By: Knoeki Re: Support base-16 in $chr() - 08/05/10 09:39 PM
Sounds like a good idea to me, argv0's syntax seems sensible, although perhaps a seperate identifier like $uchr() could be nice. Either way, I'd love to see it being added! :_)
Posted By: Riamus2 Re: Support base-16 in $chr() - 08/05/10 11:27 PM
Guess adding this would mean I have to again edit a script so it uses a different format since I'm using it as $chr(NNNN) for the unicode character. frown
Posted By: drum Re: Support base-16 in $chr() - 09/05/10 05:29 AM
Originally Posted By: Riamus2
Guess adding this would mean I have to again edit a script so it uses a different format since I'm using it as $chr(NNNN) for the unicode character. frown


No, it wouldn't break existing scripts. I believe this was the idea:

$chr(NNNN) --> treat NNNN as base 10 value
$chr(0xNNNN) --> treat NNNN as base 16 value
$chr(U+NNNN) --> treat NNNN as base 16 value
Posted By: bwuser Re: Support base-16 in $chr() - 01/07/10 07:36 PM
Do not agree. Unicode notation is hexadecimal while mirc operates with decimal numbers. Its pretty logical to have a scripter to convert before feeding to $chr()
Posted By: starbucks_mafia Re: Support base-16 in $chr() - 01/07/10 07:40 PM
Quote:
Unicode notation is hexadecimal while mirc operates with decimal numbers

Hence the suggestion.


Quote:
Its pretty logical to have a scripter to convert before feeding to $chr()

Is it? It makes far more sense to me for scripts (and therefore scripters) to use codepoints in their most common form to make it easier for anyone reading the code to recognise which characters are being represented.
Posted By: bwuser Re: Support base-16 in $chr() - 01/07/10 08:22 PM
Originally Posted By: starbucks_mafia
Quote:
Its pretty logical to have a scripter to convert before feeding to $chr()

Is it? It makes far more sense to me for scripts (and therefore scripters)

Hell is other scripters - Sartre. ;-)

In my personal opinion suggested way will add more confusion than benefit.
Posted By: hixxy Re: Support base-16 in $chr() - 02/07/10 09:10 PM
Where's the confusion? $chr() will work exactly as it always has, but there will now be a shorthand way of working with hexadecimal numbers.

It's extremely simple really:

$chr(<number>) if you want to use decimal.
$chr(0x<number>) or $chr(U+<number>) if you want to use hexadecimal.
© mIRC Discussion Forums