Open krupong opened 1 month ago
Try #79
Hello,I've try
Try #79
It's truncate some character such as "ภาษาไทย" will return "ภา".
So I've change from :
return "\xFE\xFF" . mb_convert_encoding($string, 'UTF-16BE', $encoding);
TO :
return "\xEF\xBB\xBF".mb_convert_encoding($string, 'UTF-8', $encoding);
It's show correctly.
Thank you.
So I've change from :
return "\xFE\xFF" . mb_convert_encoding($string, 'UTF-16BE', $encoding);
TO :return "\xEF\xBB\xBF".mb_convert_encoding($string, 'UTF-8', $encoding);
with that change I get this
What about using a custom encoded string when setting the metadata?
What about using a custom encoded string when setting the metadata?
That would work, but there would be the problem that every time someone doesn't know that they should do their own encoding, they will have problems and open a new issue.
@dealfonso One question, if the file says ANSI in the encoding, and the reason is in UTF-8 or another encoding, wouldn't this problem occur?
Look, I sent UTF-8 and it doesn't work
/Reason(ภาษาไทย)/Location(sdfs ó à Ã)>>
But I did send ISO-8859-1
/Reason(ó í í {} ` ~)/Location(sdfs ó í í)>>
Honestly, I have not considered this topic before. A quick search on google [1] tells me that PDF seems not to consider character encoding in a general form. It considers that the encoding depends on the font, and depending on the font, the same character will show a representation or another.
I don't know how this applies to the reason and so on.
That is why my "quick answer" is that pdf does not support utf-8 and so the users needs to encode the characters depending on their needs.
I'll read more about character encoding in the metadata. Do you have any source of info to read?
It considers that the encoding depends on the font, and depending on the font, the same character will show a representation or another
But on text contents, metadata don't use fonts
I did try FPDF, and it works with UTF-8,
/Keywords (þÿ Ì + ^ ì ò Ò ê)
But here doesn't work https://github.com/Setasign/FPDF/blob/0838e0ee4925716fcbbc50ad9e1799b5edfae0a0/fpdf.php#L1169C1-L1189C2
I try to sign with TCPDF, It work with UTF-8 too. When open in VS-Code :
Sign with sapp, seem store as plain text :
I am testing the signature -> set_metadata_props feature , but it's not show correctly. My signing reason is "ทดสอบ"
Is it support utf-8 encoding? Thank you.