In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-12-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to make unicode to gb2312 mapping table in C#". In daily operation, I believe many people have doubts about how to make unicode to gb2312 mapping table in C#. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to make unicode to gb2312 mapping table in C#". Next, please follow the editor to study!
Using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication1 {public partial class Form1: Form {public Form1 () {InitializeComponent ();} class unit_converter: IComparable {public int gb2312 = 0; public int unicode = 0 Public unit_converter () {} public unit_converter (int gb2312_0, int gb2312_1) {init_with_gb2312 (gb2312_0, gb2312_1);} private int CompareWithUnicode (unit_converter other) {return unicode.CompareTo (other.unicode) } private int CompareWithGB2312 (unit_converter other) {return gb2312.CompareTo (other.gb2312) } public int CompareTo (unit_converter other) {if (unicode = = other.unicode) {Console.WriteLine ("something wrong with gb2312:" + gb2312.ToString ("X4") + "unicode:" + unicode.ToString ("X4"));} return CompareWithUnicode (other) / / return CompareWithGB2312 (other);} private byte [] _ gb2312 = new byte [2]; private byte [] _ unicode = new byte [2]; public void init_with_gb2312 (int gb2312_0, int gb2312_1) {_ gb2312 [0] = (byte) gb2312_0 _ gb2312 [1] = (byte) gb2312_1; gb2312 = _ gb2312 [0] * 256 + _ gb2312 [1]; String s_target_gb2312 = System.Text.Encoding.GetEncoding ("GB2312"). GetString (_ gb2312); byte [] b_target_unicode = System.Text.Encoding.GetEncoding ("unicode"). GetBytes (s_target_gb2312) _ unicode [0] = b_target_unicode [1]; _ unicode [1] = b_target_unicode [0]; unicode = _ unicode [0] * 256 + _ unicode [1];} private void init_with_unicode (int unicode_0, int unicode_1) {_ unicode [0] = (byte) unicode_1 _ unicode [1] = (byte) unicode_0; unicode = _ unicode [0] * 256 + _ unicode [1]; String s_target_unicode = System.Text.Encoding.GetEncoding ("unicode"). GetString (_ unicode); byte [] b_target_gb2312 = System.Text.Encoding.GetEncoding ("GB2312"). GetBytes (s_target_unicode) _ gb2312 [0] = b_target_gb2312 [0]; _ gb2312 [1] = b_target_gb2312 [1]; gb2312 = _ gb2312 [0] * 256 + _ gb2312 [1];}} List elements = new List (); private void make_src_gb2312 () {for (int index_level_1 = 0xA1) Index_level_1 < 0xAA; index_level_1++) {for (int index_level_2 = 0xA1; index_level_2 < 0xFF; index_level_2++) {elements.Add (new unit_converter (index_level_1, index_level_2));}} for (int index_level_1 = 0xB0) Index_level_1 < 0xF7; index_level_1++) {for (int index_level_2 = 0xA1; index_level_2)
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.