将二进制数据转换为字符串[波斯语] [英] Converting Binary Data to String [In Persian]
问题描述
我正在一个需要读取包含某些波斯名称/股票工具的二进制文件的系统上.我需要将二进制数据转换为字符串以用于进一步的处理.我已经用谷歌搜索了,还没有真正找到解决我问题的方法.在这里工作过或知道如何解决此类问题的任何人?
I am working on a system that needs to read a binary file containing certain Persian names/stock instruments. I need to convert the binary data into string to be used in further processes. I have googled it and haven't really found a solution to my problem. Anyone here who has worked in such a scenario or knows how to tackle such a problem?
这是我用来将字节转换为字符串(也许很简单)的代码:
Here is the code that I am using to convert the bytes to string (simple as it maybe):
byte[] data = binaryReader.ReadBytes(amountOfData);
string symbolRead = Encoding.ASCII.GetString(data);
仅供参考,我试图将系统语言环境更改为波斯语,但这也无济于事.尽管它确实允许我查看波斯语中已经写好的文字.
FYI, I have tried to change my system locale to Persian and that hasn't helped either. Although it does allow me to view already written text in Persian.
希望找到解决方案.
谢谢.
推荐答案
请勿使用ASCII
进行编码.设置区域设置后,首先尝试使用Default
;然后尝试直接询问某人波斯最常用的编码是什么,然后使用这种编码.
Don't use ASCII
for encoding. First try using Default
after setting your locale; then try asking directly someone what encoding is most used for Persia, and use this one.
这篇关于将二进制数据转换为字符串[波斯语]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!