如何在 xml 中转义 unicode 字符 0x1F? [英] How do I escape unicode character 0x1F in xml?

查看:63
本文介绍了如何在 xml 中转义 unicode 字符 0x1F?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 utf-8 文档中用 unicode 字符 0x1F 写一个文本(它不是 xml 中允许的字符).有没有办法摆脱它,或者我必须丢弃它?

I need to write a text with the unicode character 0x1F in a utf-8 document (it is not an allowed character in xml). Is there a way to escape it, or do I have to discard it?

推荐答案

这将在 XML 1.1 中实现(但不鼓励):

This will do it in XML 1.1 (but is discouraged):



它在 XML 1.0 中完全不受支持.一种解决方法是对包含字符的文本进行 base-64 编码.

It isn't supported at all in XML 1.0. A workaround is to base-64 encode the text containing the character.

这篇关于如何在 xml 中转义 unicode 字符 0x1F?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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