Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBScript chr() appears to return wrong value

I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is:

�

However, when using something like Javascript's String.fromCharCode, 199 is:

Ç

The second result is what I need to get out of VBScript's chr() function. Any idea what the problem is?

like image 496
David Brown Avatar asked Mar 01 '23 04:03

David Brown


1 Answers

Edited to reflect comments

Chr(199) returns a 2-byte character, which is being interpreted as 2 separate characters.

  • use ChrW(199) to return a Unicode string.
  • use ChrB(199) to return it as a single-byte character
like image 165
Jimmy Avatar answered Mar 07 '23 06:03

Jimmy