Skip to content

Use UTF-8 encoding when generating XML#26

Merged
halfbyte merged 1 commit into
halfbyte:mainfrom
olieidel:main
May 23, 2025
Merged

Use UTF-8 encoding when generating XML#26
halfbyte merged 1 commit into
halfbyte:mainfrom
olieidel:main

Conversation

@olieidel
Copy link
Copy Markdown
Contributor

Hey, first off, thanks so much for your work on this library, it's really cool!

While playing around with it, I noticed that the formatting of some German characters (ß, ö, ä, ü) was screwed up. I then compared the xml output of this library with the factur-x.xml output of a third-party tool (easybill). I noticed that the first line of the xml differs:

ruby-secretariat:

<?xml version="1.0"?>
<!-- ... -->

Third-party tool (easybill):

<?xml version="1.0" encoding="UTF-8"?>
<!-- ... -->

So the conclusion here is that the encoding is set to UTF-8 explicitly and that that fixes the weird formatting of the characters.

Next, I checked how to add this to ruby-secretariat, and the change is simply to pass the UTF-8 encoding to Nokogiri when instantiating it - check out the diff to see what I mean.

This fixes the problem. The XML output now contains the encoding="UTF-8", and the characters are formatted correctly.

@halfbyte halfbyte merged commit 2bfe84f into halfbyte:main May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants