« Return to Thread: URIResolver in combination with filenames with unicode characters fails - Problem in AbstractImageSessionContext#toFile?

Re: URIResolver in combination with filenames with unicode characters fails - Problem in AbstractImageSessionContext#toFile?

by Andreas Delmelle-2 :: Rate this Message:

Reply to Author | View in Thread

On 27 Jun 2009, at 21:19, Peter Coppens wrote:

Hi Peter

Sorry for the rather late reply. Busy weekend...

<snip />

> and two image files
> -  http://www.nabble.com/file/p24235918/hexley.png hexley.png
> -  http://www.nabble.com/file/p24235918/h%25C3%25A9xl%25C3%25A6.png
> héxlæ.png
> <snip />
> 1426 [main] ERROR
> org
> .apache
> .xmlgraphics.image.loader.impl.AbstractImageSessionContext(104) -
> Error while opening file. Could not load image from system identifier
> 'file:/eb2/trunk/playground/h%C3%A9xl%C3%A6.png'

<snip />
> I think the problem might lie in AbstractImageSessionContext#toFile  
> where
> unicode escapes are apparently not taken into account.

But they are. That's what the loop starting at line 252 is meant for.

Weird thing... I'm suspecting some form of double-escaping is taking  
place.

I get the following output with Java 6 on Mac OS X, using only ERROR-
level output:

resolve on héxlæ.png canRead returns false
Jun 29, 2009 9:38:16 AM  
org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext  
newSource
SEVERE: Unable to obtain stream from system identifier 'file:/
Developer/javatools/xml-fop-trunk/h%C3%A9xl%C3%A6.png'
Jun 29, 2009 9:38:16 AM  
org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext  
newSource
SEVERE: The Source that was returned from URI resolution didn't  
contain an InputStream for URI: héxlæ.png
Jun 29, 2009 9:38:16 AM org.apache.fop.events.LoggingEventListener  
processEvent
SEVERE: Image not found. URI: héxlæ.png. (See position 14:110)

Changing to create the StreamSource using the String-constructor (as  
opposed to File), the output becomes:

resolve on héxlæ.png canRead returns false
Jun 29, 2009 10:10:48 AM  
org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext  
newSource
SEVERE: The Source that was returned from URI resolution didn't  
contain an InputStream for URI: héxlæ.png
Jun 29, 2009 10:10:48 AM org.apache.fop.events.LoggingEventListener  
processEvent
SEVERE: Image not found. URI: héxlæ.png. (See position 14:110)

Changing the FO to use an absolute file:-URL as the src attribute of  
the fo:external-graphic, I still get an error when using the File-
constructor, but when using the String-constructor, it produces a  
correct PDF...
[Note that, strictly speaking, the XSL-FO Recommendation does require  
the src property to be specified as a URI. See: http://www.w3.org/TR/xsl/#src 
]

All I can say for the moment: under investigation.


Regards

Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@...
For additional commands, e-mail: fop-users-help@...

 « Return to Thread: URIResolver in combination with filenames with unicode characters fails - Problem in AbstractImageSessionContext#toFile?