In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge about "how to decode GB2312 in. NET Compact Framework". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
The code is as follows:
Imports System.TextImports System.IOModule Module1Module Module1 Sub Main()Sub Main() Dim sr As New StreamReader("D:gb2312.txt") Dim fs As New FileStream("D:gb2312.dat", FileMode.Create) Dim sw As New BinaryWriter(fs) For i As Integer = 1 To 70 sr.ReadLine() Next Do Until sr.EndOfStream Dim ss As String() = sr.ReadLine.Split Dim HEX As Short = CShort(Val(ss(1).Replace("0x", "&H"))) Dim offset As Integer = (CInt(Val(ss(0).Replace("0x", "&H"))) - &H2121) * 2 sw.BaseStream.Position = offset sw.Write(HEX) Loop sw.Close() End SubEnd Module
When using, subtract 0x8080 from the GB2312 code to be decoded, subtract 0x2121 (offset), that is, subtract 0xA1A1, and then point FileStream.Position to twice the result (two bytes a code) and read an Int16 to get the corresponding Unicode code. Below is a code I have in my Palm IP.
public class GB2312ToUnicode { private FileStream fs; private BinaryReader br; public GB2312ToUnicode(string index) { fs=new FileStream(index, FileMode.Open); br = new BinaryReader(fs); } public char Convert(byte[] b) { int index = ((b[0]
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.