weird chAracTerS

Discussion in 'NZ Computing' started by shane, Nov 15, 2007.

  1. shane

    shane Guest

    I've written a funky little application in java, that receives data from a
    network stream. I am writing the strings I get from the BufferedReader, using
    readLine(), to stderr, and a JTextArea.
    The problem is, using netcat, I see
    :ACTION ok
    stderr gives me
    : ACTION ok
    and JTextArea gives me
    : ACTION ok

    Brilliant I cant paste them. What you may not be able to see is std err gives
    me a box with four chars within (one in each corner), 3 0's and a 1
    The JTextArea places squares in the same places (sans the chars in the corners).
    This strongly suggests to me, that I need to render the string in a diff char
    set

    It *may* be related to http://en.wikipedia.org/wiki/UTF-8#Java
    As I am indeed using InputStreamReader
    Anyway, any thoughts on the subject appreciated
    --
    Hardware n: Parts of the computer you can kick
    shane, Nov 15, 2007
    #1
    1. Advertising

  2. In message <fhgnrj$62t$>, shane wrote:

    > I've written a funky little application in java, that receives data from a
    > network stream. I am writing the strings I get from the BufferedReader,
    > using readLine(), to stderr, and a JTextArea.


    I believe in Java, all strings are internally kept in Unicode. How are you
    reading the strings--could it be that it is simply taking pairs of bytes
    from the input and interpreting them as UTF-16 or UCS-2 characters?

    Perhaps you need to interpose a UTF-8 decoder in the stream or something.
    Lawrence D'Oliveiro, Nov 15, 2007
    #2
    1. Advertising

  3. shane

    shane Guest

    Lawrence D'Oliveiro did scribble:

    > In message <fhgnrj$62t$>, shane wrote:
    >
    >> I've written a funky little application in java, that receives data from a
    >> network stream. I am writing the strings I get from the BufferedReader,
    >> using readLine(), to stderr, and a JTextArea.

    >
    > I believe in Java, all strings are internally kept in Unicode. How are you
    > reading the strings--could it be that it is simply taking pairs of bytes
    > from the input and interpreting them as UTF-16 or UCS-2 characters?
    >
    > Perhaps you need to interpose a UTF-8 decoder in the stream or something.


    A week later I have discovered what the characters represent.
    I am now dumping them to hex to see about catching them and dealing with them

    --
    Hardware n: Parts of the computer you can kick
    shane, Nov 20, 2007
    #3
    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. Replies:
    1
    Views:
    4,758
    Ranjit
    Oct 31, 2004
  2. moi je
    Replies:
    0
    Views:
    423
    moi je
    Oct 6, 2005
  3. Adam White

    Cannot enter all 26 characters for WEP-128 key?

    Adam White, Dec 24, 2005, in forum: Wireless Networking
    Replies:
    2
    Views:
    10,297
    dmsethi
    Jun 17, 2009
  4. Kevin Darling
    Replies:
    2
    Views:
    621
    Kevin Darling
    Apr 18, 2004
  5. MBell72398

    Advise on working around these weird characters on XP

    MBell72398, Apr 23, 2004, in forum: Computer Information
    Replies:
    0
    Views:
    319
    MBell72398
    Apr 23, 2004
Loading...

Share This Page