Support For Unicode Characters In Filenames And Paths
你好
مرحبا
おはよう ございます
привет
HALLÅ
हैलो
What have I written above you might be wondering? Well, I’ve tried* to write hello in a few different languages to highlight the new support for Unicode characters in filenames and paths — which was introduced with the release of version 7.15 of Quick PDF Library. The great news is that all of the above characters can now be properly handled in filenames and paths by all editions of our SDK.
There are many different ways to encode Unicode characters. One way is to use strings with 16-bit characters. COM/ActiveX uses 16-bit characters, so adding Unicode support for the ActiveX edition of the library was easy.
For the Delphi and DLL editions, the strings have always been 8-bit characters and unfortunately we can’t change the definition of functions to use strings with 16-bit characters as this would cause issues with backwards compatibility.
This means that when using the Delphi and DLL editions and working with Unicode characters, you need to encode your file names with UTF8 encoding, as mentioned in the function reference.
Different languages will have different functions to do the UTF8 encoding. For Delphi, the Utf8Encode function can be used, for example:
var
FileNameW: WideString;
FileNameA: AnsiString;
begin
FileNameW := WideString('C:\unicode') + WideChar(20081) +
WideString('\test.pdf');
FileNameA := Utf8Encode(FileNameW);
QP.SaveToFile(FileNameA);
end;
That would save the file in the “C:\unicode乱\test.pdf” folder.
So far the response to the addition of this hotly demanded feature has been has been fantastic. If you have any other features that you really want to see added to Quick PDF Library in the not-to-distant future, visit our feedback page where you can suggest new features and vote on features that other customers have suggested.
* I hope I’ve written hello — if I’ve written something else, please let me know!