Results 1 to 4 of 4
  1. #1
    devu1982 is offline Member
    Join Date
    Mar 2009
    Posts
    2
    Rep Power
    0

    Default Having trouble using multi-byte charset?

    Hi there,
    Can someone assist me on below?
    I would like to write a multi-byte string in a flat file where stipulated length is provided.
    Field A = xyz (all are Chinese chars and each char occupies 2 bytes)

    Say, space provided for field A in database is 5 bytes, and I would like to store first two chars (x and y here) and save a blank space. I dont want to save third
    Char z since there is no sufficient space.

    How can I achieve this? Any help would be highly appreciated.


    Regards,
    Devarajan

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    7

    Default

    Java Code:
    String.getBytes()
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    devu1982 is offline Member
    Join Date
    Mar 2009
    Posts
    2
    Rep Power
    0

    Default

    HI Nicholas,
    Thanks for your reply.
    But my problem is quite different..
    I would like to store either xyz .. or xy alone(when 'z' couldnt be stored)
    So,I would like to know how to check if a multi-byte char has been stored partially?
    Is there any method in API or any idea?


    Thanks,
    Devarajan
    Last edited by devu1982; 03-02-2009 at 06:33 PM.

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Java runs on Unicode, and Unicode provides support for Chinese characters. If you have a String containing Chinese characters, just save them using a Writer.

Similar Threads

  1. Byte Array
    By sandor in forum New To Java
    Replies: 12
    Last Post: 01-15-2009, 03:31 AM
  2. using Byte arrays
    By mew in forum New To Java
    Replies: 2
    Last Post: 01-30-2008, 03:54 AM
  3. BufferedImage to Byte
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-22-2008, 08:17 PM
  4. int to byte
    By ravian in forum New To Java
    Replies: 1
    Last Post: 01-13-2008, 07:22 PM

Posting Permissions

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