mIRC Home    About    Download    Register    News    Help

Print Thread
#221107 07/05/10 09:31 PM
Joined: Oct 2003
Posts: 3,641
A
argv0 Offline OP
Hoopy frood
OP Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
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.

Joined: Apr 2010
Posts: 964
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 964
$char($base(#,16,10)) ^.^

Joined: Oct 2003
Posts: 3,641
A
argv0 Offline OP
Hoopy frood
OP Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
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.

Joined: Apr 2010
Posts: 964
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 964
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(...)

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Agreed, that would be very handy.

Joined: Jan 2009
Posts: 116
K
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2009
Posts: 116
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! :_)

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
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

Joined: Dec 2002
Posts: 294
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 294
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

B
bwuser
bwuser
B
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()

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
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.

B
bwuser
bwuser
B
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.

Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
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.


Link Copied to Clipboard