# XML UTF-8 Character Encoding

When generating XML, explicitly set the document to UTF-8 character encoding.

If using other encoding methods (eg, MacRoman for OS X), special characters such as μg/ml are stored incorrectly. This could cause data integrity issues.

In Groovy, set the encoding attribute on the StreamingMarkupBuilder object as shown in the following example:

<figure><img src="https://2084401275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfjuebS41N49G1Eh55hP7%2Fuploads%2Fgit-blob-b78fb68ae9dab976722ef0602024e2ecf1b17eb0%2FXMLUTF8CharacterEncoding_swCL.jpeg?alt=media" alt=""><figcaption></figcaption></figure>
