Asc()VB函数中的错误?

Ale*_*der 4 vb.net string

你能告诉我为什么Asc()函数返回错误的结果吗?

    Dim TestChar = Chr(128)
    Dim CharInt = Asc(TestChar) ' this is a mistake on Windows 7 x64. Asc(TestChar) returns 136 instead of 128
Run Code Online (Sandbox Code Playgroud)

我在另一台计算机上执行此代码,结果是128.

谢谢.

SLa*_*aks 12

您的计算机使用的是其他默认代码页.

Asc函数使用系统的当前ANSI代码页.
Chr函数只是将值转换为char.(除非是> 255)