1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-->
<refentry id="fn_serialize_to_UTF8_xml">
<refmeta>
<refentrytitle>serialize_to_UTF8_xml</refentrytitle>
<refmiscinfo>xml</refmiscinfo>
</refmeta>
<refnamediv>
<refname>serialize_to_UTF8_xml</refname>
<refpurpose>Converts argument to its UTF-8 string representation.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_serialize_to_UTF8_xml">
<funcprototype id="fproto_serialize_to_UTF8_xml">
<funcdef><function>serialize_to_UTF8_xml</function></funcdef>
<paramdef>in <parameter>value</parameter> any</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_serialize_to_UTF8_xml">
<title>Description</title>
<para>The function converts its argument to a narrow string in
UTF-8 encoding. The way conversion is done depends on the type of
the argument.</para>
<para>If <parameter>value</parameter> is a wide (national) string
or a LONG NVARCHAR then it is directly converted to UTF-8 string.</para>
<para>If <parameter>value</parameter> is a string or a LONG VARCHAR
then it is converted from current charset of client connection to the UTF-8.</para>
<para>If <parameter>value</parameter> is an XML entity then it is
converted to its XML text representation in UTF-8 encoding. The resulting
string is a well-formed XML document if the given entity is an element entity,
otherwise it may be well-formed generic entity, i.e. it can be parsed by
an XML parser only as a part of some other XML document.</para>
<para>If <parameter>value</parameter> is NULL, the NULL is returned.</para>
<para>Values of other types are first converted to VARCHAR, this
intermediate VARCHAR is converted from current charset of client connection
to the UTF-8 and is returned.</para>
</refsect1>
<refsect1 id="params_serialize_to_UTF8_xml">
<title>Parameters</title>
<refsect2><title>value</title>
<para>The value of arbitrary type to be converted into its UTF-8 string representation.</para>
</refsect2>
</refsect1>
<refsect1 id="ret_serialize_to_UTF8_xml"><title>Return Types</title>
<para>UTF-8 string or NULL.</para>
</refsect1>
<refsect1 id="examples_serialize_to_UTF8_xml">
<title>Examples</title>
<example id="ex_serialize_to_UTF8_xml"><title>UTF-8 encoding of non-ASCII characters</title>
<para>A sample document is parsed and the resulting entity is serialized to UTF-8 string.</para>
<screen><![CDATA[
select serialize_to_UTF8_xml(xtree_doc('<text>0-9 a-z A-Z €-ÿ Ā-ǿ Ѐ-῿</text>'));
callret
VARCHAR
_______________________________________________________________________________
]]>
<text>0-9 a-z A-Z €-ÿ Ā-ǿ Ѐ-῿</text>
</screen>
</example>
</refsect1>
<refsect1 id="seealso_serialize_to_UTF8_xml">
<title>See Also</title>
<para><link linkend="fn_charset_recode"><function>charset_recode</function></link></para>
</refsect1>
</refentry>
|