javascript - Why does chr(199) appear to return the wrong value in VBScript? - Stack Overflow

I'm trying to convert a character code to a character with chr(), but VBScript isn't giving m

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?

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?

Share Improve this question edited Nov 20, 2024 at 14:26 TylerH 21.1k78 gold badges79 silver badges113 bronze badges asked Nov 24, 2008 at 22:23 David BrownDavid Brown 36.3k12 gold badges89 silver badges139 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

Edited to reflect ments

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

Encoding is the problem. Javascript may be interpreting as latin-1; VBScript may be using a different encoding and getting confused.

The fromCharCode() takes the specified Unicode values and returns a string.

The Chr() function converts the specified ANSI character code to a character.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742340084a4425446.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信