The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Yen characters and HTML form field issues :-)

I know, this post should appear as a comment to the article 'Phantom Currency Signs in Japan and Korea' (
but their commenting system rejected my post due to 'suspicious input data'.

I just came across a Japanese site; the order form there made me think of the above mentioned article:
the page is delivered with charset SHIFT_JIS.
They have body text, input fields and textareas like this:

<META http-equiv="Content-Type" content="text/html; charset=SHIFT_JIS">
1. \
<br />
4. <input value="\" type="text" />
<br />
3. <input value="\" type="text" style="font-family: 'Arial unicode';" />
<br />
2. <input value="\" type="text" style="font-family: monospace;" />
<br />
5. <textarea>\</textarea>

I noticed that I can enter a Yen sign in the textarea by hitting \ on my 'western' keyboard, as expected.
As the browser auto-chooses (?) a font matching the SHIFT_JIS charset I expected this to be the case for the input fields, too.
But both Gecko-based browsers and Internet Explorer 6 rendered my \ as a backslash in the input fields, unless I explicitly set the font-family style attribute to force the browser to use a different font for the input's text. Using something like 'arial unicode' or 'sans-serif' worked with the Gecko browsers, not with IE; 'monospace' worked with both.
Even more strange, IE failed to render the body text \ as a Yen sign.

Any good ideas anyone how to handle this reliably?
egbert Send private email
Friday, October 28, 2005
Great question (the other site probably rejected the HTML tags). Hopefully someone else will chime in, but I have a couple comments.
1. First of all, are you sure you want a yen sign and not a path separator. If it is part of a pathname then oscillating between appearing as a backslash and yen sign is to be expected
2. If your users that need to see the yen sign have their machines set to the Japanese locale then they will likely see the yen signs, and you shouldn't have to worry
3. You could go with UTF-8 instead of Shift-Jis. Then copy and paste an actual yen sign ¥ rather than a backslash. As long as the text stays in Unicode, it will not get converted back to a backslash.
Ben Bryant
Friday, October 28, 2005
Thanks a lot for your response, Ben!

Firstly, I agree with you on the use of UTF-8; I honestly don't see a reason for using SHIFT-JIS if you can use something like UTF-8.

The subject of this topic, along with my reference to the codesnipers article, are probably a little misleading.
I'm not concerned with coding Japanese content, but rather with the question how browsers auto-choose a font, based on some enigmatic (to me) decisions, why this is not done consistently for all document elements and, finally, how we can deal with it (to avoid browser-dependent outcomes).

The fact that not every font provides all kinds of characters obviously led to the creation of the above mentioned browser 'intelligence', but I never saw an explanation of the underlying mechanisms.
egbert Send private email
Friday, October 28, 2005
A few thoughts:
1. specifying the font style in the HTML might work a little differently in the different browsers, and certainly the way they determine font face based on locale and browser preferences may differ
2. an even bigger obstacle to getting a consistent appearance everywhere is the different locales and available fonts on the client machines.
3. the path separator is a unique issue that does not say much about any of the other font issues involved. You might want to go with the flow on this one rather than trying to exert your impression of consistency to the yen/backslash scenario. A better way to investigate browser font choices is to use a variety of Chinese Japanese, Cyrillic, Greek, even Hebrew (bidi).
4. Something you said seemed to assume that the font choice may be based on the existence of the yen sign in the particular font, but the yen sign is going to be available in pretty much every font because it is in Windows-1252
Ben Bryant
Friday, October 28, 2005
> and certainly the way they determine font face based on locale and browser preferences may differ

Yep, would be interesting to understand this.

Regarding the consistent appearance issue, I've given up on this some time ago ;-)

You're certainly right: the path separator seems to be something special, which is understandable.

> Something you said seemed to assume that the font choice may be based on the existence of the yen sign in the particular font

Nope, I was just refererring to the general ability of browsers to choose fonts 'wisely'
egbert Send private email
Monday, October 31, 2005
O.k., this all boils down for me to one question:
does anyone know how to find out what font a browser actually uses to render a certain element (or CSS rule)?
egbert Send private email
Thursday, November 03, 2005

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz