www.webdeveloper.com
Results 1 to 4 of 4

Thread: How can I use chars from different charsets?

  1. #1
    Join Date
    Oct 2010
    Posts
    9

    How can I use chars from different charsets?

    Hello everyone, I'm looking for some help. What I'd to know is how to refer to characters from different charsets like Herbrew or Japanese characters simultaneously, as well as English and all others within the same script block.

    E.g,

    [code]
    if ( xx[K]=="C" ) { N = 1;}
    if ( xx[K]=="荐" ) { N = 2;}
    [\code]

    Please note that I'm using notepad which would never accept the Chinese character shown and that code only represents my intention. I'd gladly use a html value like &#32.

  2. #2
    Join Date
    Oct 2010
    Posts
    18
    Not sure about the nature of your question.

    Do you what to test for a given input character?

    Code:
    var str = '荐';
    if ( str.charCodeAt(0) == 0x8350 ) { 
      alert('Unified Han ideograph'); 
    }
    if you just wish to display the string in Javascript you can type

    var str = '\u8350';

    Don't think there is any 'standard' way of detecting language input in JavaScript.

    You can always just test for the begining and ending of the Unicode charcater set using hex.

    Code:
    var str = '\u05f1';
    var code = str.charCodeAt(0); 
    
    if ( code >= 0x0590 && code <= 0x05ff ) {  
      alert('Hebrew character');  
    }
    http://www.unicode.org/ has a full listing of all language unicode tables.

  3. #3
    Join Date
    Oct 2010
    Posts
    9
    Thanks for the link.

  4. #4
    Join Date
    Oct 2010
    Posts
    9
    I've got it to work now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles