Support for ISO_IR 58 in .Net 4.0

A DICOM named ISO_IR 58 has a double-byte character set. As far as I can tell, the equivalent encoding for this in .Net is gb2312. I am trying to encode ISO_IR 58 characters in 7 bits ASCII for communication between medical systems.

In the java world, the gb2312 line works to do this encoding.

First look at this example for ISO_IR 87 (ISO_IR 87 is iso-2022-jp in .Net):

Encoding enc = Encoding.GetEncoding("iso-2022-jp");
byte[] bytes = enc.GetBytes("叙収參参^去厰厦厘=却占^卮博南");
string asciistring = ASCIIEncoding.ASCII.GetString(bytes);

This takes an input string and gives an ASCII string: $ B = v <} RT; 2 (B ^ $ B5nRRRONR (B = $ B5Q @j (B ^ $ BRHGnFn (B

with all the correct escape sequences that I can use correctly.

(the actual first escape character is not displayed here, but the rest of the sequence does when inserted)

If I use this code with characters from ISR_IR 58:

Encoding enc = Encoding.GetEncoding("gb2312");
byte[] bytes = enc.GetBytes("ㄆㄉㄊㄋ^ㄌㄍㄐㄓ^ㄖㄠㄢㄤ");
string asciistring = ASCIIEncoding.ASCII.GetString(bytes);

:???????? ^???????? ^????????

, DICOM ISO_IR 58 .Net? ? ISO_IR 58 DICOM .Net? .Net? ?

+4
2

ASCIIEncoding - 7- , 8- . , .

:

Encoding enc = Encoding.GetEncoding("gb2312");
byte[] bytes = enc.GetBytes("ㄆㄉㄊㄋ^ㄌㄍㄐㄓ^ㄖㄠㄢㄤ");

Encoding asc = Encoding.GetEncoding("iso-8859-1");
string astr = asc.GetString(bytes);

A8 C6 A8 C9 A8 CA A8 CB 5E A8 CC A8 CD A8 D0 A8 D3 5E A8 D6 A8 E0 A8 E2 A8 E4 
¨Æ¨É¨Ê¨Ë^¨Ì¨Í¨Ð¨Ó^¨Ö¨à¨â¨ä
+5

, IANA, ISO-IR-58 GB_2312-80 GB2312, .NET Framework x-cp20936 20936. :

Encoding.GetEncoding("x-cp20936");

Encoding.GetEncoding(20936);

, , .


, Java GB2312, , , ISO-IR-58. . , DICOM ( MS Word), ISO_IR 58 IANA ISO-2022-CN. , IANA, ? , IAIA , , , DICOM , . , .Net ISO-2022-CN, .

Wikipedia, ISO-2022-CN :

ESC $) A GB 2312-1980 (2 ) [ G1]
ESC $) G CNS 11643-1992 1 (2 ) [ G1]
ESC $* H CNS 11643-1992 2 (2 )

, Java ESC $ ) A, , GB2312, . , :

  • GB2312 (1980). , . , GB_2312-80 ? , , IANA, - .

  • , GBK GB18030. Hmmm,.Net Framework GBK, GB18030 54936. , , , , .

  • , GB2312, :

2015 Microsoft.Net Framework A. iconv-1.14, php-5.6, ActivePerl-5.20, Java 1.7, Python 3.4 B. [2] Ruby 2.2 A, B, A.

? :.Net Framework A, Java B.

+3

Source: https://habr.com/ru/post/1607919/


All Articles