nio and default charset

Discussion in 'Java' started by Stefano, Jun 4, 2004.

  1. Stefano

    Stefano Guest

    Hi,

    there is a way to specify the default nio charset use by jvm? On my
    linux, jdk1.4.2, jvm start up with utf-8, i need it to start with
    iso-8859-1. I cannot simply open stream specifying different charset.

    Thank you, Dolce.
     
    Stefano, Jun 4, 2004
    #1
    1. Advertising

  2. On 4 Jun 2004 02:35:31 -0700, Stefano wrote:
    > there is a way to specify the default nio charset use by jvm? On my
    > linux, jdk1.4.2, jvm start up with utf-8, i need it to start with
    > iso-8859-1. I cannot simply open stream specifying different
    > charset.


    NIO channels, like streams, are used for reading bytes not characters,
    and as such don't use charsets at all (default or otherwise).

    If you need to convert a byte[] to a String using a specific encoding,
    use the appropriate String constructor with the received byte data.

    Note that you can get a Reader from your channel that converts to
    characters according to a particular encoding, but then you don't use
    NIO for reading anymore.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Jun 4, 2004
    #2
    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. iksrazal

    NIO with timeouts != NIO?

    iksrazal, Jun 17, 2004, in forum: Java
    Replies:
    1
    Views:
    6,377
    iksrazal
    Jun 18, 2004
  2. Replies:
    0
    Views:
    3,447
  3. jimgardener

    nio charset doubt

    jimgardener, Jul 2, 2008, in forum: Java
    Replies:
    3
    Views:
    323
    jimgardener
    Jul 2, 2008
  4. cs_professional
    Replies:
    14
    Views:
    5,470
    cs_professional
    Dec 12, 2010
  5. optimistx

    javascript charset <> page charset

    optimistx, Aug 14, 2008, in forum: Javascript
    Replies:
    2
    Views:
    297
    optimistx
    Aug 15, 2008
Loading...

Share This Page