UTF-8 and Unicode in general allow different forms of encoding for umlaut and other characters, which JavaScript translates with the normalize function. Both are valid representations of the same characters:
- NFD Fails: If I use NFD (like
0075 + 0308 for ü) it doesn't work. The ü is showing a replacement character and additional space afterwards.
- NFC Works: If I use NFC (like
00FC for ü) it works and the characters are printed correctly in the PDF.
Reproduce
Also the playground editor doesn't handle them properly (text inserted afterwards is 1 character off). To reproduce it, you can copy the following code into there:
var dd = {
content: [
'Text für Bug',
'Text für Bug'
]
}
and you will get the following result:

Workaround
Normalize all strings given to pdfmake with "someString".normalize("NFC")
UTF-8 and Unicode in general allow different forms of encoding for umlaut and other characters, which JavaScript translates with the normalize function. Both are valid representations of the same characters:
0075+0308for ü) it doesn't work. The ü is showing a replacement character and additional space afterwards.00FCfor ü) it works and the characters are printed correctly in the PDF.Reproduce
Also the playground editor doesn't handle them properly (text inserted afterwards is 1 character off). To reproduce it, you can copy the following code into there:
and you will get the following result:

Workaround
Normalize all strings given to pdfmake with
"someString".normalize("NFC")