Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Need to print Multibyte character.

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need to print Multibyte character.

    Hi All.
    Please help me resolve this issue.

    Value of \u00E6 is æ ( Multibyte Character ).

    But from the value is comming from client browser like String reportFileName = "/Users/admin/Reports/Japanese\\u00E6";

    If I take sys out of the reportFileName the value will be printed. /Users/admin/Reports/Japanese\u00E6. But Actual file name is /Users/admin/Reports/Japaneseæ

    Can some help me you resolve this issue.

    Thanks
    Vivek S.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need to print Multibyte character.

    You're using two slashes. The first slash escapes the second slash, turning it into a slash character instead of an escape character.

    If you want to escape the unicode value, use a single slash before the u.

    System.out.println("\u00E6");
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need to print Multibyte character.

    Hi Kevin,
    Thanks for your reply, input value /Users/admin/Reports/Japanese\\u00E6, is coming from client ( front end). And Java is parsing value as /Users/admin/Reports/Japanese\u00E6 instead of /Users/admin/Reports/Japaneseæ . I have tried split string into char array then reform it in many ways.. but still I am not able form multibyte character.

    Please help me

    Thanks
    vivek s.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need to print Multibyte character.

    Java is parsing it correctly. A single \ escapes a character. So two slashes results in the first \ escaping the second \, which creates a plain-old slash character. Anything following it will be treated as a normal character instead of being escaped.

    You're either going to have to parse the text to remove the second slash (which has its own complications, such as what should happen when the user really does want two slashes), or change the frontend to only send a single slash like it should.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 1
    Last Post: December 3rd, 2012, 02:35 PM
  2. How to print numbers using do while, for loop and if else statement?
    By techlover in forum Loops & Control Statements
    Replies: 1
    Last Post: October 30th, 2012, 02:13 PM
  3. Print out a triangle by character *
    By Genky in forum What's Wrong With My Code?
    Replies: 26
    Last Post: August 20th, 2012, 06:33 AM
  4. xfa.host.print: print a page + some page range.
    By gammaman in forum Totally Off Topic
    Replies: 2
    Last Post: May 10th, 2012, 08:07 AM
  5. The character '' is an invalid XML character exception getting
    By sumanta in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 9th, 2010, 12:13 PM

Tags for this Thread