Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Special Characters File names |
Post Reply |
Author | |
Ilana
Beginner Joined: 22 Nov 11 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 22 Nov 11 at 3:30AM |
Hi,
When trying to open a pdf file in a directory that has German characters, the returned handle is 0. Which means that the file could not be opened. The command DAOpenFile when the file is: "c:\\drop\\ùéèçà1232\\pages.pdf". Any solution for that? I am using "QuickPDFDLL0723.dll". Thanks, Ilana.
|
|
Wheeley
Senior Member Joined: 30 Oct 05 Location: United States Status: Offline Points: 146 |
Post Options
Thanks(0)
|
I can think of 3 ideas.
1. Make sure you send the file name as a UTF8 encoded string to the 7.23 DLL. 2. Try the 7.26 DLL with UTF8 encoding as well 3. Upgrade to version 8 with full unicode support Wheeley |
|
Ilana
Beginner Joined: 22 Nov 11 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
|
I am using UTF-8 characters which has their value is bigger then 127. For example one of the characters has the Ansi value of 199 and 200. Can you please advice? Thanks, Ilana.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Ilana!
Wheeley already told you what to do ... Try things like this: QP.LoadFromFile(Pchar( AnsiToUtf8(c:\\drop\\ùéèçà 1232\\pages.pdf) )) QP.LoadFromFile(UTF8Encode('c:\\drop\\ùéèçà 1232\\pages.pdf') ...and don't forget Wheeley's ideas 2 and 3 ;-) Cheers and welcome here, Ingo |
|
Ilana
Beginner Joined: 22 Nov 11 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Thanks!
For future users, here is the actual code, that works:
In C++: char *fname = "C:\\Temp\\Digi drop\\ùéèçà123\\pages.pdf"; const int SIZE = 1024; // Bytes char* text = new char[SIZE]; WCHAR w[SIZE]={0}; int erg=MultiByteToWideChar(CP_ACP, 0, fname, -1, w, SIZE); // ANSI to UNICODE erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, SIZE, 0, 0); // UNICODE to UTF-8 int hndFile = _QuickPDFDAOpenFile (InstanceID, text, NULL); if (hndFile != 0) { int x = 1; } In Java 6 - How to get the same UFT-8 path: public String getAsString (String result) { byte[] bt = result.getBytes(); ByteArrayOutputStream sw = new ByteArrayOutputStream (bt.length); OutputStreamWriter osw; try { osw = new OutputStreamWriter (sw, "UTF8"); BufferedWriter out = new BufferedWriter (osw); out.write(result ); out.close(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return sw.toString(); } |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store