PB7 转换为 PB10.5 后的编码问题

发布于 2024-12-01 17:24:59 字数 100 浏览 2 评论 0原文

从 PB7 转换为 10.5 后,我在旧版本中遇到问题 存储SQL Server数据库阿拉伯字符,显示字符 在数据窗口中作为奇怪的符号,没有像 ÓíÇÑÉ ÕÛíÑÉ 这样的含义?

After i convert from PB7 to 10.5 i have problem in old
storage SQL server database Arabic character,it shows the characters
in datawindow as strange symbols that has no meaning like ÓíÇÑÉ ÕÛíÑÉ ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

憧憬巴黎街头的黎明 2024-12-08 17:24:59

迁移到 PB10 或更高版本时需要注意两件事。 外部函数调用中的字符串以及任何文件中读取的数据,例如 ini 文件或文件读取函数。原因是PB10是字符串基于Unicode而不是ANSI的版本。

当字符串数据曾经正常工作时,您将开始遇到问题,其中包含垃圾字符。好消息是 PB 提供了一种将字符串转换为所需格式的方法,并且两者都有函数。

默认的 PB10 编码是 UTF-16,小端(EncodingUTF16LE!)

在 PB10 中,PowerScript 函数 Len()、Left()、Mid() 和 Right() 都是基于 Unicode 字符的,相当于现有的 LenW( )、LeftW()、MidW() 和 RightW() 函数。

为了将字符串作为字节或 ASCII 字符而不是 Unicode 字符进行操作,添加了一组新的 LenA()、LeftA()、MidA() 和 RightA() 函数。当应用“A”函数时,PowerBuilder 将根据计算机的区域设置将 Unicode 字符串转换为 DBCS 字符串,然后应用该操作。是任何文件的读/写,因为在 PB10 左右它转到了 unicode。 PB 将所有现有函数转换为 Unicode 并创建了函数的新版本。因此,在 PB10 Powerscript 中,函数 Len()、Left()、Mid() 被更改为 unicode 和新函数 Len。

 Blob lbl_data
 lbl_data = Blob("Hello World!", EncodingANSI!)
 ls_data = String(lbl_data, EncodingANSI!)


 // PB10 and higher
 li_FileNum = FileOpen("MyFile.txt", TextMode!, Read!, EncodingANSI!)

 // PB9 and lower you didn't need EncodingANSI!
 //li_FileNum = FileOpen("MyFile.txt", TextMode!)

如果不添加 EncodingANSI 会发生什么! ?从外部文件获取的所有数据都将是不可读的垃圾字符。这是升级到 PB10 及更高版本时最重要的问题,但一旦弄清楚它就很容易解决。

我不认为你的数据库问题与编码有关,但这是可能的。如果您看到垃圾字符,则可能与编码不匹配。

Two things you need to look at when migrating to PB10 or higher. Strings in external function calls and any data read in files, such as ini files or file read functions. The reason why is that PB10 was the version where strings were based on Unicode instead of ANSI.

You'll start running into problems where your string data has garbage characters when it used to work fine. The good news is that PB provides a way to convert the string to the required format and there are functions for both.

The default PB10 encoding is UTF-16, little endian (EncodingUTF16LE!)

In PB10, the PowerScript functions Len(), Left(), Mid(), and Right() are all Unicode character based and are equivalent to the existing LenW(), LeftW(), MidW(), and RightW() functions.

To manipulate strings as bytes or ASCII characters instead of Unicode characters, a new set of LenA(), LeftA(), MidA(), and RightA() functions have been added. When the ‘A’ functions are applied, PowerBuilder will convert the Unicode string to a DBCS string based on the machine’s locale, and then apply the operation. is any reading/writing of files because around PB10 it went to unicode. PB converted all the existing functions to Unicode and created new versions of the functions. So in PB10 Powerscript functions Len(), Left(), Mid() were changed to unicode and new functions Len.

 Blob lbl_data
 lbl_data = Blob("Hello World!", EncodingANSI!)
 ls_data = String(lbl_data, EncodingANSI!)


 // PB10 and higher
 li_FileNum = FileOpen("MyFile.txt", TextMode!, Read!, EncodingANSI!)

 // PB9 and lower you didn't need EncodingANSI!
 //li_FileNum = FileOpen("MyFile.txt", TextMode!)

What happens if you don't add EncodingANSI! ? All the data you get from external files will be unreadable garbage characters. This is about the most significant issue when upgrading to PB10 and above, but it's very simple to resolve once you figure it out.

I don't think your database issues are related to the encoding but it is possible. If you are seeing garbage characters you probably have mismatches with encoding.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文