...

View Full Version : Writing Unicode with JS



ConfusedOfLife
08-23-2002, 09:17 PM
How can I write unicode with javascript? Is it possible? What I see around here is that ppl use FrontPage and a program called Keyman for writing unicode, is there anyway that we don't use Frontpage? I couldn't understand what Frontpage really does and if we can do that ourselves. Many thanks in advance...

mordred
08-24-2002, 03:05 PM
You can use unicode escape sequences in JavaScript (I believe since JS1.5). They are fairly easily employed, you just write '\uXXXX' and in place of the x'es you write the desired hexadecimal digits of your unicode character.

As an example,



alert("Hello \u00C5land");


gives you an alert with the scandinavian capital A with the ring on top. I don't know how far unicode is supported by the browsers, you'll have to test yourself.

See also
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/ident.html#1009568

ConfusedOfLife
08-25-2002, 10:45 PM
Thank you mordred, but one more question, what do you do if you want to write unicode? Do you use Front Page? I said ppl around me use a software called Keyman and also Frontpage to write unicode, I wanted to see if it's another/other way(s) for doing that, and also I saw somewhere a function called "getunicode()" or something like that that I think was for JS, what JS can do for this unicode and how far does it support it?

mordred
08-25-2002, 11:24 PM
I don't know this keyman program and I have had no exposure at all to FrontPage (luckily ;)), so I can't comment on how they work and if there are any substitutes. Since I'm based in Europe and most of my characters used in web apps would be either in the ASCII subset or easily represented as HTML entities, I have not had the need to develop anything in unicode entirely, sorry, just no real experience in that field.

What do you want to achieve anyway? Do you want to write a webpage or a javascript app entirely in unicode? I recall that you can set the encoding of xml/xhtml to unicode, so you could do all your coding in that charset (but I'm not 100% positive on this).

As to support... I'll guess you have to find out yourself by testing the browsers if they stand true to what the browser vendors promise.

ConfusedOfLife
08-25-2002, 11:39 PM
Well, I write unicode pages! But as I said you have to write your page first, then open the page in Frontpage and press ( shift + rightAlt) and start typing, if the keyman is installed and you did the modifications on your frontpage, then what you see is the characters that you want ( Farsi language in my case ), but like you, I didn't work with frontpage either ( luckily! ) and I'm not easy with it. Also I think if it's possible to write unicode without frontpage, then, let's write it! It's not just writing that, By learning how to do something, you will find some new doors in front of you that you can go for, you know what I mean! I just want to know at least how to write unicode in some other ways! ( excluding the frontpage)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum