smantha1979
asked on
how to read unicode datas from mysql and save it to xml file?
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 :(
ASKER
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 :)
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 :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.GetEncode
int byteCount = UniCodeEncoder.GetByteCoun
Byte[] bytes = new Byte[byteCount];
int bytesEncodedCount = UniCodeEncoder.GetBytes(s,
//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