mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2023
Posts: 15
Pikka bird
OP Offline
Pikka bird
Joined: Oct 2023
Posts: 15
Here a Sample Code:

Code
alias test {

  var %spec.asctmp 不
  var %spec.asc $asc(不)
  var %spec.asc1 $asc(%spec.asctmp)

  var %spec.chrtmp $chr(55358)
  var %spec.chr $chr(%spec.asc)
  var %spec.chr1 $chr(%spec.asc1)

  echo -a SPEC.ASCTMP: %spec.asctmp
  echo -a SPEC.ASC: %spec.asc
  echo -a SPEC.ASC1: %spec.asc1
  echo -a SPEC.CHRTMP: %spec.chrtmp
  echo -a SPEC.CHR: %spec.chr
  echo -a SPEC.CHR1: %spec.chr1
  echo -a Copy & Paste Character: 不
  echo 4 -a Can anyone explain this ?

}



Why is the smiley face displayed in the Mirc when copied and pasted, but not with $chr


Best Regards from Germany
-=[atomic10]=-
Joined: Jul 2006
Posts: 4,105
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,105
Hello, this is because of unicode and how mirc represent data with utf16, the smiley face use two 16 bits value, called surrogates, to encode that character, when you use $asc(<smileyface) $asc will only return the value of the first 16 bits, the second 16 bits value can be obtained with $asc($mid(<smileyface>,2,1)).

$chr and $asc deal with 16 bits value, representing that smiley face takes two of them.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2023
Posts: 15
Pikka bird
OP Offline
Pikka bird
Joined: Oct 2023
Posts: 15
Originally Posted by Wims
$chr and $asc deal with 16 bits value, representing that smiley face takes two of them.

That's it ! - Many Thanks :-)

You made my Day ! grin


Best Regards from Germany
-=[atomic10]=-

Link Copied to Clipboard