Print Page | Close Window

problem with special characters in file paths

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1631
Printed Date: 11 Jun 26 at 2:17AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: problem with special characters in file paths
Posted By: Cord Viking
Subject: problem with special characters in file paths
Date Posted: 08 Nov 10 at 10:25AM
The following file path specification for function signfile() will result in an errorcode 2 "pdf-file not found":
 
AFilePath := 'E:\Users\j.düvel\AppData\Local\test.pdf';
 
AQuickPDF.SignFile(AFilePath,...)
 
We have to create this path from the environment variable %USERPROFILE%, so we have no control over what username has been choosen.
 
Is there a solution for this problem?



Replies:
Posted By: Cord Viking
Date Posted: 08 Nov 10 at 10:28AM
The editor also has a problem with these chars, hope display is correct here:
 
AFilePath := 'E:\Users\j.düvel\AppData\local\test.pdf'


Posted By: Cord Viking
Date Posted: 08 Nov 10 at 10:30AM
Disabled wysiwyg, hope display is correct now:

AFilePath := 'E:\users\j.düvel\AppData\local\test.pdf'


Posted By: Cord Viking
Date Posted: 08 Nov 10 at 10:33AM
sorry - now way, giving up!
Anyway, the problem should be the dot, so use this as example:

AFilePath := 'E:\users\j.duevel\AppData\local\test.pdf';


Posted By: Rowan
Date Posted: 08 Nov 10 at 11:12AM
You need to encode your string with UTF-8 encoding if it uses any unicode characters.

var
 
FileNameW: WideString;
 
FileNameA: AnsiString;
begin
 
FileNameW := WideString('C:\unicode') + WideChar(20081) +
WideString('\test.pdf');
 
FileNameA := Utf8Encode(FileNameW);
 QP
.SaveToFile(FileNameA);
end;


Posted By: Cord Viking
Date Posted: 08 Nov 10 at 11:39AM
Problem solved! Thank's a lot!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk