> Ok, I use a resource file for all text and then put it in the > html page using c:out, etc. But, what about Hebrew & Arabic? > They need to be marked with dir="RTL". I can make the message > <span dir="RTL">hi there</span> but then I can't escape any > text and have to make sure I have escaped things in my messages. > > And I have a feeling this could get weird where some of the > text on my page I am pulling from a database and have no idea > what it's direction is.
My solution is that I have a custom tag, and the internal processing code looks something like this: .rtlclass {font-family:David,arial;font-size:12px;direction:rtl} if (isRTL(myStr)) { out.append("<span class='rtlclass'>‏"); out.append(myStr); out.append("‏</span>"); } public static final boolean isRTL(final String str) { for (int i = 0; i < 3; i++) { if (str.length() == i) return false; Character.UnicodeBlock block = Character.UnicodeBlock.of(str.charAt(i)); if (block == Character.UnicodeBlock.ARABIC || block == Character.UnicodeBlock.ARABIC_PRESENTATION_FORMS_A || block == Character.UnicodeBlock.ARABIC_PRESENTATION_FORMS_B || block == Character.UnicodeBlock.HEBREW) { return true; } } return false; } The "‏" on both sides is important because otherwise the browser *will* screw up if you have punctuation at the end of the string. Another thing to note is that, for some reason, all browsers tend to render non-Latin fonts in a very teensy size. I don't know why. So it's a good idea to have code to make sure that rtlclass has a bigger fontsize than you would normally use. Daniel --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]