如何添加xml编码<?xml version =“1.0”encoding =“UTF-8”?>到xml输出SQL Server

前端之家收集整理的这篇文章主要介绍了如何添加xml编码<?xml version =“1.0”encoding =“UTF-8”?>到xml输出SQL Server前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
可能是一个没有答复的副本.
SQL Server 2008 – Add XML Declaration to XML Output

请让我知道,如果这是可能的.我读了一些博客

http://forums.asp.net/t/1455808.aspx/1

http://www.devnewsgroups.net/group/microsoft.public.sqlserver.xml/topic60022.aspx

但是我不明白为什么我不能这样做.

你必须手动添加它. sql Server始终将xml内部存储为ucs-2,因此sql不可能生成一个utf-8编码头

请参阅MSDN上的“Limitations of the xml Data Type”

The XML declaration PI,for example,<?xml version='1.0'?>,is not preserved when storing XML data in an xml data type instance. This is by design. The XML declaration (<?xml ... ?>) and its attributes (version/encoding/stand-alone) are lost after data is converted to type xml. The XML declaration is treated as a directive to the XML parser. The XML data is stored internally as ucs-2.

原文链接:https://www.f2er.com/xml/292949.html

猜你在找的XML相关文章