Accidental Reverse order String display

Discussion in 'Java' started by Roedy Green, Aug 10, 2005.

  1. Roedy Green

    Roedy Green Guest

    I discovered the oddest thing. drawString in AWT and JTextArea in
    Swing were painting one line in my font sample in reverse order.
    It is stored in normal order, and displays on the console in normal
    order.

    It looks like this:

    public static final String currencySymbols =
    "$ " // $
    + "\u00a2 " // cent sign
    + "\u00a3 " // pound sterling sign
    + "\u00a4 " // general currency sign
    + "\u00a5 " // Yen
    + "\u060b " // Afghani sign
    + "\u0e3f " // Thai Baht
    + "\u17db " // Kmer Riel
    + "\u20a1 " // Costa Rica Colon
    + "\u20a2 " // Brazil Cruzeiro
    + "\u20a3 " // French Franc
    + "\u20a4 " // Lira
    + "\u20a5 " // mil
    + "\u20a6 " // Nigera Naira
    + "\u20a7 " // Spain Peseta
    + "\u20a8 " // India Rupee
    + "\u20a9 " // Korea Won
    + "\u20aa " // Israel new shequel
    + "\u20ab " // VietName Dong
    + "\u20ac " // Euro
    + "\u20ad " // Laos Kip
    + "\u20ae " // Mongolia Tugrik
    + "\u20af " // Greek Drachma
    + "\u20b1 " // peso
    + "\u20b2 " // Paraguay Gurani
    + "\u20b4 " // Urkraine Hryvnia
    + "\u20b5 " // Ghana cedi
    + "\ufdfc"; // rial

    I gather the presence of some exotic character in there is sufficient
    to trigger that behaviour.

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
     
    Roedy Green, Aug 10, 2005
    #1
    1. Advertising

  2. On Wed, 10 Aug 2005 19:36:51 GMT, Roedy Green wrote:

    > I discovered the oddest thing. drawString in AWT and JTextArea in
    > Swing were painting one line in my font sample in reverse order.
    > It is stored in normal order, and displays on the console in normal
    > order.

    ....
    > I gather the presence of some exotic character in there is sufficient
    > to trigger that behaviour.


    Yes, it is like the effect you see displayed by this code..
    <http://www.physci.org/launcher.jsp?class=/codes/eg/JArabicInUnicode>

    Because it is Arabic, the letters appear in reverse order.

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    Scratch Here To Reveal Prize
     
    Andrew Thompson, Aug 10, 2005
    #2
    1. Advertising

  3. Roedy Green wrote:
    > I discovered the oddest thing. drawString in AWT and JTextArea in
    > Swing were painting one line in my font sample in reverse order.
    > It is stored in normal order, and displays on the console in normal
    > order.
    >
    > It looks like this:
    >
    > public static final String currencySymbols =
    > "$ " // $
    > + "\u00a2 " // cent sign
    > + "\u00a3 " // pound sterling sign
    > + "\u00a4 " // general currency sign
    > + "\u00a5 " // Yen
    > + "\u060b " // Afghani sign
    > + "\u0e3f " // Thai Baht
    > + "\u17db " // Kmer Riel
    > + "\u20a1 " // Costa Rica Colon
    > + "\u20a2 " // Brazil Cruzeiro
    > + "\u20a3 " // French Franc
    > + "\u20a4 " // Lira
    > + "\u20a5 " // mil
    > + "\u20a6 " // Nigera Naira
    > + "\u20a7 " // Spain Peseta
    > + "\u20a8 " // India Rupee
    > + "\u20a9 " // Korea Won
    > + "\u20aa " // Israel new shequel
    > + "\u20ab " // VietName Dong
    > + "\u20ac " // Euro
    > + "\u20ad " // Laos Kip
    > + "\u20ae " // Mongolia Tugrik
    > + "\u20af " // Greek Drachma
    > + "\u20b1 " // peso
    > + "\u20b2 " // Paraguay Gurani
    > + "\u20b4 " // Urkraine Hryvnia
    > + "\u20b5 " // Ghana cedi
    > + "\ufdfc"; // rial
    >
    > I gather the presence of some exotic character in there is sufficient
    > to trigger that behaviour.
    >


    How about a SSCCE?

    Ray

    --
    XML is the programmer's duct tape.
     
    Raymond DeCampo, Aug 10, 2005
    #3
  4. Roedy Green

    Roedy Green Guest

    On Wed, 10 Aug 2005 19:36:51 GMT, Roedy Green
    <> wrote or quoted :

    >I discovered the oddest thing. drawString in AWT and JTextArea in
    >Swing were painting one line in my font sample in reverse order.
    >It is stored in normal order, and displays on the console in normal
    >order.


    It turns out a single character is the culprit
    // + "\u060b " // Afghani sign

    Remove that from the list and it behaves normally.

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
     
    Roedy Green, Aug 10, 2005
    #4
  5. Roedy Green

    Roedy Green Guest

    On Wed, 10 Aug 2005 19:45:59 GMT, Andrew Thompson
    <> wrote or quoted :

    >Yes, it is like the effect you see displayed by this code..
    ><http://www.physci.org/launcher.jsp?class=/codes/eg/JArabicInUnicode>


    That is so neat. I never would have guessed it was so straight
    forward.

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
     
    Roedy Green, Aug 10, 2005
    #5
  6. Roedy Green

    jan V Guest

    > That is so neat. I never would have guessed it was so straight forward.

    If you're impressed by that little snippet of internationalization support,
    you'll be mightily impressed by the stuff contained in O'Reilly's excellent
    book called "Java Internationalization".. it's pretty amazing what Java can
    do on that front (and which virtually nobody uses...!).
     
    jan V, Aug 10, 2005
    #6
  7. Roedy Green

    Jeff Schwab Guest

    Andrew Thompson wrote:

    > <http://www.physci.org/launcher.jsp?class=/codes/eg/JArabicInUnicode>



    Internal Server Error
    The server encountered an internal error or misconfiguration and was
    unable to complete your request.

    Please contact the server administrator, and
    inform them of the time the error occurred, and anything you might have
    done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use
    an ErrorDocument to handle the request.
    Apache/1.3.33 Server at www.physci.org Port 80
     
    Jeff Schwab, Aug 11, 2005
    #7
  8. On Thu, 11 Aug 2005 00:19:03 -0400, Jeff Schwab wrote:

    > Andrew Thompson wrote:
    >
    >> <http://www.physci.org/launcher.jsp?class=/codes/eg/JArabicInUnicode>

    >
    > Internal Server Error


    Yes, the poor server needs a little TLC.
    The URL should come good later though.

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    No Humans Were Probed In The Making Of This Episode
     
    Andrew Thompson, Aug 11, 2005
    #8
  9. On Wed, 10 Aug 2005 20:31:40 GMT, Roedy Green wrote:

    > On Wed, 10 Aug 2005 19:45:59 GMT, Andrew Thompson
    > <> wrote or quoted :
    >
    >>Yes, it is like the effect you see displayed by this code..
    >><http://www.physci.org/launcher.jsp?class=/codes/eg/JArabicInUnicode>

    >
    > That is so neat. I never would have guessed it was so straight
    > forward.


    It is neat, but there was a niggling doubt in my mind
    that I thought I'd better check. Ahhh, yep. Here it is..
    <http://groups.google.com/group/comp.lang.java.programmer/msg/0086cdc2bfbc82b7>

    You do a lot of 1.1 applets, right? The reversing effect
    of the printing will *not* work in the MSVM.

    (Though you might accommodate the MSVM by specifically
    checking for it and ..reversing the text. ..uggh. )

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    Bender's Humor By 'Microsoft Joke'
     
    Andrew Thompson, Aug 11, 2005
    #9
  10. Roedy Green

    Jeff Schwab Guest

    Andrew Thompson wrote:
    > On Thu, 11 Aug 2005 00:19:03 -0400, Jeff Schwab wrote:
    >
    >
    >>Andrew Thompson wrote:
    >>
    >>
    >>><http://www.physci.org/launcher.jsp?class=/codes/eg/JArabicInUnicode>

    >>
    >>Internal Server Error

    >
    >
    > Yes, the poor server needs a little TLC.
    > The URL should come good later though.


    Much better now. And yes, that's neat. :)
     
    Jeff Schwab, Aug 11, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wim Roffal

    accidental chinese char

    Wim Roffal, Nov 13, 2003, in forum: HTML
    Replies:
    11
    Views:
    669
    Leif K-Brooks
    Nov 13, 2003
  2. has
    Replies:
    7
    Views:
    362
  3. Clark C. Evans
    Replies:
    4
    Views:
    368
  4. Replies:
    15
    Views:
    459
    James Lothian
    Aug 3, 2011
  5. Replies:
    3
    Views:
    207
Loading...

Share This Page