Skip to content

Commit

Permalink
Fix XML encoding marker²
Browse files Browse the repository at this point in the history
  • Loading branch information
coreequip committed Sep 24, 2024
1 parent 8cf8af6 commit e260359
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Optional<String> validate(HttpExchange exchange) throws IOException {
String xml = new String(requestBody, charset);

// Remove BOM if present
if (xml.startsWith("\uFEFF")) {
if (xml.startsWith("\uFEFF") || xml.startsWith("\uFFFE")) {
xml = xml.substring(1);
}

Expand Down
10 changes: 8 additions & 2 deletions src/test/http/api-test.http
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ Accept-Language: de

< ./output_with_bom.xml

### Generate a PDF file from a XML with UTF-16
### Generate a PDF file from a XML with UTF-16 BE
POST {{baseUrl}}/convert.pdf
Content-Type: application/xml
Accept-Language: de

< ./base-example-utf16.xml
< ./base-example-utf16be.xml

### Generate a PDF file from a XML with UTF-16 LE
POST {{baseUrl}}/convert.pdf
Content-Type: application/xml
Accept-Language: de

< ./base-example-utf16le.xml
File renamed without changes.
Binary file added src/test/http/base-example-utf16le.xml
Binary file not shown.

0 comments on commit e260359

Please sign in to comment.