保存转义字符0x1b在一个XML文件 [英] Saving an escape character 0x1b in an XML file

查看:876
本文介绍了保存转义字符0x1b在一个XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有使用其内部打印机字体打印机通信的应用程序。这需要使用一个字体描述属性发送一些数据以二进制格式。

We have an application that communicates with printers using their internal printer fonts. This requires sending some data in a binary format using a font description property.

人物之一要发送的转义字符(0x1b)。该系统的状态,并改变了所有选项后保存在一个XML文件,但是当我们尝试写的价值,我们得到了以下异常:

One of the characters to be sent is an escape character (0x1b). The state of the system and all options changed are later saved in an XML file, but when we try to write the value, we get the following exception:

System.InvalidOperationException: There is an error in XML document (1009, 26). ---> System.Xml.XmlException: '[Some small backwards arrow symbol]', hexadecimal value 0x1B, is an invalid character.

我真的不知道为什么这个箭头的功能逃跑,但它在打印机上。当我们试图将它保存在一个XML文件中出现的错误。有什么建议?

I'm not really sure why this arrow functions as escape, but it works on the printer. The error occurs when we try to save it in an XML file. Any suggestions?

推荐答案

iSimilar问题:

iSimilar question to:

我怎么逃单code字为0x1F在XML?

所以无论是不推荐的方法

So either the not recommended approach of



或使用基64中提到的达林的答案

or using base-64 as mentioned in Darin's answer

这篇关于保存转义字符0x1b在一个XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆