?
Solved

how to read unicode datas from mysql and save it to xml file?

Posted on 2004-09-17
5
Medium Priority
?
440 Views
Last Modified: 2010-05-18
i can view the datas with php throught web pages. but when i try to read the data with C# and save to xml, it doesn't work :(
0
Comment
Question by:smantha1979
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12093462
suggest the data you read from mysql is store in char[] sa and it is a UniCode

char [] sa;
string s

//some code to receive data in s or sa
//you can change s to sa by your demand

Encoder UniCodeEncoder = Encoding.UniCode.GetEncoder();

int byteCount = UniCodeEncoder.GetByteCount(s, 0, s.Length, true);
Byte[] bytes = new Byte[byteCount];
int bytesEncodedCount = UniCodeEncoder.GetBytes(s, 0,s.Length, bytes, 0, true);
//ok it change to UniCode
// bytesEncodedCount is the real changed bytes number
 Console.WriteLine("{0} bytes used to encode characters.", bytesEncodedCount );
//show the encoded bytes
Console.Write("Encoded bytes: ");
  foreach (Byte b in s) {
        Console.Write("[{0}]", b);
   }//the result is save in bytes

0
 

Author Comment

by:smantha1979
ID: 12094222
thankz for reply.
i found out that, its because of bytefx, bytefx depends on mysql's server character, and mysql uses latin, that's why it can't read when the character set doesn't match the default character set,, i give myself 250 points :)
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 12436190
PAQed, with points refunded (250)

CetusMOD
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

800 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