帮助亚洲人物,编码&观众。试图将韩文文本写入文件 [英] Help with asian characters, encodings & viewers. Trying to write korean text to a file
问题描述
我需要将韩文字符写入DXF文件(这是一个AutoCAD图形文件,它不是二进制文件而是文本)。
我们的客户为我们提供了一个来自竞争产品的DXF文件,输出韩文字符(在某些观看者中查看..)
现在(AFAIK)他们的dxf文件中没有UTF或其他标题输出
dfx文件的前16个字符是
I need to write Korean characters into a DXF file (that's an AutoCAD drawing file, it's not binary but text).
Our customer has supplied us with a DXF file from a rival product that outputs Korean characters (when viewed in some viewers..)
Now (AFAIK) there is no UTF or other header in their dxf file output
First 16 characters of the dfx file are
20 20 20 20 30 0D 0A 20 37 35 0D 0A 20 20 20 20
Notepad ++中文件的相关位看起来像这样
The relevant bit of the file in Notepad++ looks like this
디엠에스에스
和十六进制查看器
and in a hex viewer
B5 F0 BF A5 BF A1 BD BA BF A1 BD BA
使用Notepad ++我可以复制和粘贴单个字符,并按预期在该文件中查看。
如果我尝试和用我自己的DXF输出做同样的事情
Notepad ++
Using Notepad++ I can copy and paste individual characters and they view as expected within that file.
If I try and do the same thing with my own DXF output
Notepad ++
µð
十六进制编辑器
Hex editor
B5 F0
如果我强制Notepad ++使用UTF编码,它看起来像这样
and if I force Notepad++ to use UTF encoding it looks like this
xB5 xF0
根据我的理解(我今天早上在这里的文章中读到的内容:-)),观众会在阅读时尝试解释编码。我不确定我的输出有什么问题。
我尝试过:
关于Codeproject和其他地方的文章
From what I understand (what I've read in articles here this morning :-) ) the viewer tries to interpret the encoding as it reads it. I'm not sure what the problem with my output is.
What I have tried:
Articles on Codeproject and elsewhere
推荐答案
更多阅读
< a href =https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets- no-excuses /> 绝对最低每个软件开发人员绝对必须知道Unicode和字符集(没有借口!) - Joel on Software [ ^ ] [ ^ ]
+添加UTF8-BOM字符有助于查看者将这些字符视为DBCS
A bit more reading
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) – Joel on Software[^][^]
+ Adding the UTF8-BOM characters helps the viewer see these characters as DBCS
这篇关于帮助亚洲人物,编码&观众。试图将韩文文本写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!