How to link to an image with a Kanji filename?
August 24, 2005 12:08 PM   Subscribe

I18n and HTML: How do display images that have kanji filenames, in both IE (PC) and Safari (Mac).

So there I was minding my own business writing code that lets users export HTML reports, very image-heavy reports, that link to these images like so:

<img src="foo001.html"/><img src="foo002.html"/><img src="foo003.html"/> ...

Where the user decides the value of 'foo'. But then to my shock and disgust I find that Safari and IE can't seem to agree about what to do if "foo.html" is &#x30D5.html?

The W3C comment about non-ASCII characters in URIs is a bit discouraging. Safari seems to obey the recommendation without having the common courtesy to do the expected natural thing, while IE doesn't have any truck with the workaround.

I'll resort to JavaScript if I have to, but I was wondering if anyone knows of the happy medium, a format acceptable to both IE and Safari.
posted by fleacircus to Computers & Internet (3 answers total)
 
Best answer: The workaround works for me in both Firefox 1.0.6 and IE6/Windows. (I don't have Safari handy to test, sorry.)

Details: My HTML page declares its encoding as UTF-8. My href attribute is "%e3%83%95.html" (the urlencoding of the UTF-8 bytes of "&30D5;.html"). I'm using an HTML 4 doctype so my page is rendered in standards mode.

Here's a live example that you can test in Safari and IE: フ.html


posted by mbrubeck at 2:18 PM on August 24, 2005


(To clarify: If the link in my post above takes you to a page that says "test", then your browser supports the urlencoded UTF-8 link. If you get a "page not found" error, then your browser does not support the urlencoded link.)
posted by mbrubeck at 2:33 PM on August 24, 2005


Response by poster: mrbrubeck: can you get it then to work on an image?

say if by フ.html you had a フ.gif, can you get it to show with:

<img src="%e3%83%95.gif"/>

Perhaps I haven't been using the doctype right...
posted by fleacircus at 5:03 PM on August 24, 2005


« Older Study abroad in England   |   Why are my spaghetti afflicted so? Newer »
This thread is closed to new comments.