Simple method for converting UCS2 encoded in Delphi into GB2312 encoding

xiaoxiao2021-03-06  72

I have been doing a SMS related project. SMS from China Unicom Gateway Deliver is UCS2 encoded.

I found some information on the Internet to find some code that uses the API conversion with the Java language itself, but there is no suitable Delphi source code, so I wrote one after the study, very simple:

Function UCS2TOGBK (Const INVALUE: STRING): String; var i: = '; for i: = 1 to Length (Invalue) Div 2 - 1 Do Result: = Result Widechar (STRTOINT (' $ " INTTOHEX (ORD (INVALUE [2 * I - 1]), 2) INTTOHEX (ORD (Invalue [2 * I]), 2)));

转载请注明原文地址:https://www.9cbs.com/read-120358.html

New Post(0)