Fenton Posted April 27, 2008 Posted April 27, 2008 (edited) I just ran into an odd problem. I have a file that gets book images from Amazon. It didn't work on a couple. The reason was that there was a % character ("%2B" was the combo) in the file name (which was in the xml returned from a web services request to Amazon). What I found was that FileMaker translates (unescapes) the % and characters following in a file path, in the image path; so the path to the file is not valid. The latter surprised me, as % is valid in a file system file path (silly perhaps, but valid). There is no way you can use that file path to Insert or show an image file. The work-around, which was simple enough, was to remove the % character when writing the file (using curl to download, file path stored in a FileMaker field, where I could easily remove the %). I could not think of any way to make FileMaker accept the % sign in the path. Edited April 28, 2008 by Guest Web Viewer works fine
comment Posted April 27, 2008 Posted April 27, 2008 I am not sure what situation you describe. I have an image file named "FM&P.png", and I see that a calculated container shows this image, whether the supplied path is: image:FM%P.png or image:FM%25P.png Going the other way around, the calculated path is "image:FM%25P.png". It might be different if the reference is a URL (where the % character is reserved).
Fenton Posted April 28, 2008 Author Posted April 28, 2008 (edited) The problem seems to be limited to HTML entities. So "%2B" is translated to "+" and the path fails, so does "%20" (space). Strangely enough, you can use Insert manually with one of these file names. But you will not see the same name in the GetAsText ( image ). 51s85%20bmbDL.jpg becomes: 51s85%2520bmbDL.jpg Duh, I just figured it out. "%25" is the URL encoded entity for "%". So FileMaker is escaping "%", but only when it is the 1st character of an HTML character entity. So, you can do the same, in your calculation for the file path, Substitute ( file name; "%"; "%25" ) Or, like I did earlier, just write the file without it. Edited April 28, 2008 by Guest
comment Posted April 28, 2008 Posted April 28, 2008 Yeah, I can see it now - it is kinda weird. If I ask it to show "image:FM%20P.png", it says it cannot find the file "FM P.png". However, GetAsURLEncoded ( Path ) seems to fix it. I wonder if one should always use that, or are there cases where it will break an otherwise valid path...
Fenton Posted April 28, 2008 Author Posted April 28, 2008 Yeah, apparently a FileMaker syntax path is not just what it seems. There's some escaping behind the scenes. GetAsURLEncoded ( file name ) works, and is probably the best method. But if I do more of the path than that, it doesn't work. I think escaping the % will also always work, because I think all HTML entities begin with %. But I'm no expert on this. I imagine Amazon let the characters be escaped by the xml engine. I'm sure they know better than I. You will not see the same thing with the actual images on their web pages.
comment Posted April 28, 2008 Posted April 28, 2008 Actually, HTML/XML entities begin with an ampersand - percent-encoding is for URLs. But if I do more of the path than that, it doesn't work. What do you mean by that? Like, what happens if you URL-encode the entire path?
Recommended Posts
This topic is 6113 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now