Unicode characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • schneider@rz.uni-frankfurt.de

    Unicode characters

    as a biginner,

    maybe I have a question already answered 1000 times but I do not know
    how to find the answers.

    problem:

    depending on an input value, I would like to output greek characters
    (f. e. those between U+03B1 to U+03C9. One way would be to define two
    arrays: one with the possible input values ("abgde...") and a second
    array with the corresponding values ("\u03b1\u03b2\ u03b3...").

    But I hoped I could skip the second by a computation, f.e. "g" has
    index 2 in the first array, so output "\u03b1"+2.

    This does not work (of course). But do I have a chance to "compute"
    the output value?

    Thanks
    Hanspeter

  • Janwillem Borleffs

    #2
    Re: Unicode characters

    schneider@rz.un i-frankfurt.de wrote:
    But I hoped I could skip the second by a computation, f.e. "g" has
    index 2 in the first array, so output "\u03b1"+2.
    >
    This does not work (of course). But do I have a chance to "compute"
    the output value?
    >
    Perhaps is the following useful:

    alert(String.fr omCharCode("\u0 3b1".charCodeAt (0) + 2));


    JW


    Comment

    • Bart Van der Donck

      #3
      Re: Unicode characters

      schnei...@rz.un i-frankfurt.de wrote:
      maybe I have a question already answered 1000 times but I do not know
      how to find the answers.
      >
      problem:
      depending on an input value, I would like to output greek characters
      (f. e. those between U+03B1 to U+03C9. One way would be to define two
      arrays: one with the possible input values ("abgde...") and a second
      array with the corresponding values ("\u03b1\u03b2\ u03b3...").
      Yes it looks like Greek-Greeklish has been done many times before:





      But I hoped I could skip the second by a computation, f.e. "g" has
      index 2 in the first array, so output "\u03b1"+2.
      >
      This does not work (of course). But do I have a chance to "compute"
      the output value?
      Considering the character conversions at

      I think you need a lookup-table anyhow.

      Hope this helps,

      --
      Bart

      Comment

      Working...