# UTF8 strings in XML

**URL:** <https://forum.xojo.com/t/utf8-strings-in-xml/53741>\
**Category:** General\
**Created:** [May 9, 2020, 1:23pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741 "2020-05-09T13:23:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [May 9, 2020, 1:23pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741/1 "2020-05-09T13:23:21Z")

</div>

Whats the easiest way to create an XML document that can contain UTF characters such a or , or potentially problematic characters such as newline  
and keep the text readable?

I have in the past used encodebase64 for my internal formats, but if I am creating a publicly viewable format, is there some setting I can use to ensure that the XML.tostring generates a human readable output?

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [May 9, 2020, 1:51pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741/2 "2020-05-09T13:51:23Z")

</div>

Is there an issue with [XMLDocument](https://documentation.xojo.com/api/text/xml/xmldocument.html)?

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [May 9, 2020, 2:12pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741/3 "2020-05-09T14:12:02Z")

</div>

Make sure the doctype line has right encoding matching the encoding of your string.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [May 9, 2020, 3:26pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741/4 "2020-05-09T15:26:07Z")

</div>

> [@487884:@Tim Parnell](#):
>
> Is there an issue with [XMLDocument](https://documentation.xojo.com/api/text/xml/xmldocument.html)?

Well, I’m pretty sure (gonna have to check) that I lost accented characters writing and reading wthout wrapping the text or using encode.

I’ll run some small tests.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [May 9, 2020, 3:50pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741/5 "2020-05-09T15:50:32Z")

</div>

Hmm… seems to work out of the box.  
Even with endofline characters.  
I wonder why I ran into problems a few years back…

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:24pm UTC](https://forum.xojo.com/t/utf8-strings-in-xml/53741/6 "2021-04-29T16:24:05Z")

</div>


