How to Convert UTF-8 Arabic letters to CodePage 1001?

ぐ巨炮叔叔 提交于 2019-12-01 21:29:21
Marc Gravell

Untested, but:

String s = Encoding.UTF8.GetString(bytes);
Encoding enc = Encoding.GetEncoding(1001);
byte[] arr2 = enc.GetBytes(s);

Of course, skip the first line if you are actually starting with a string, but since you mention UTF-8 I assumed binary.

Obviously for large data volumes you might use a TextReader/TextWriter (each with encoding) instead - but same idea.

i don't think the original person who asked still needs the answer but this thread seems pretty famous and i don't want anyone to waste his time to find what i found the hard way..so

this answer relies primarily on the application provided with the Star Micronics TSP printer

key points: - reference "Interop.OposPOSPrinter_CCO.dll" - the printer object should be of type oposposprinter.printer and is initialized in a slightly different way (compared to opos.net) - the character codes are sent as a string and there's a variable to tell the printer object to use these decimal numbers as character codes

a sample VB.net project with a simple arabic letter converter can be found at https://bitbucket.org/loody/arabic-1001/overview

note: i don't have time to cover the rest of the letters/numbers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!