Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to convert an UTF-8 String to Big5 String

Posted on 2004-11-07
5
Medium Priority
?
1,565 Views
Last Modified: 2008-02-26
Anyone knows how to convert an UTF-8 String to Big5 String?
0
Comment
Question by:yysasa
  • 3
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 1500 total points
ID: 12520739
It would be something like:

String s = new String(utfbytes, "UTF-8");
byte[] big5bytes = s.getBytes("Big5");
0
 

Author Comment

by:yysasa
ID: 12521002
I tried the following code (strUTF8 contains UTF-8 characters):
String s = new String(strUTF8.getBytes(), "UTF-8");
byte[] big5bytes = s.getBytes("Big5");
String strResult = new String(big5bytes, "Big5");

but the strResult is not in Big5 format, why?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12521982
>>but the strResult is not in Big5 format, why?

How are you determining this? For instance, if you're viewing the result in a Windows console, it won't support that encoding
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12521988
Try to view it with a Swing component with its Font set to one that supports Big5 characters
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12564565
>>but the strResult is not in Big5 format, why?

Why did you post that comment after using the same code principle as in the comment you marked as the answer?
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question