How can I display Chinese under Compact Framework?

  • Thread starter Thread starter Cheryl
  • Start date Start date
C

Cheryl

I am sending a bytestream of Chinese characteratics through sockets. I need
to display the Chinese characters (possibly BIG5 words) in my Pocket PC.
How can I do that? The output only consists of question marks when I
implement the code below:

checkbox.Text = "";
String checkpath = @"\My Documents\~result.txt";
if (File.Exists(checkpath))
{
File.Delete(checkpath);
}
FileStream checkfs = File.Create(checkpath);
BinaryWriter checkw = new BinaryWriter
(checkfs,System.Text.Encoding.UTF8);

// Receive the transcribed text for verification first

byte[] bytes = new byte[resultClient.ReceiveBufferSize];
resultstream.Read(bytes,0,bytes.Length);
checkw.Write(bytes);
checkw.Close();

//Convert the bytes received to a string
String checking;

checkfs = new FileStream (checkpath,FileMode.Open,FileAccess.Read);
StreamReader checkr = new StreamReader(checkfs);

checking = checkr.ReadLine();
checkr.Close();

checkbox.Text = checking;
 
Hi,

Does your Pocket PC support Chinese?

You can check what was written into the text file
by opening it in Pocket Word.
If you found this file is full of question marks,
try to use "System.Text.Encoding.Unicode" in your
previous code.

Let me know if this helps!
--
Best Regards,
Jan Yeh

MCP, .NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan
 
I have tried your method but it didn't seem to work
I am using a Pocket PC 2002 with Chinese support and with .NET cf installed

Jan Yeh said:
Hi,

Does your Pocket PC support Chinese?

You can check what was written into the text file
by opening it in Pocket Word.
If you found this file is full of question marks,
try to use "System.Text.Encoding.Unicode" in your
previous code.

Let me know if this helps!
--
Best Regards,
Jan Yeh

MCP, .NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan

Cheryl said:
I am sending a bytestream of Chinese characteratics through sockets. I need
to display the Chinese characters (possibly BIG5 words) in my Pocket PC.
How can I do that? The output only consists of question marks when I
implement the code below:

checkbox.Text = "";
String checkpath = @"\My Documents\~result.txt";
if (File.Exists(checkpath))
{
File.Delete(checkpath);
}
FileStream checkfs = File.Create(checkpath);
BinaryWriter checkw = new BinaryWriter
(checkfs,System.Text.Encoding.UTF8);

// Receive the transcribed text for verification first

byte[] bytes = new byte[resultClient.ReceiveBufferSize];
resultstream.Read(bytes,0,bytes.Length);
checkw.Write(bytes);
checkw.Close();

//Convert the bytes received to a string
String checking;

checkfs = new FileStream (checkpath,FileMode.Open,FileAccess.Read);
StreamReader checkr = new StreamReader(checkfs);

checking = checkr.ReadLine();
checkr.Close();

checkbox.Text = checking;
 
When you say that you've tried Jan Yeh's method, what do you mean, exactly?
You've tried typing Chinese characters into Pocket Word and *that* doesn't
work, or you've tried using System.Text.Encoding.Unicode and *that* doesn't
work? You need to be very detailed and specific in your posts so that we
can understand what works and what doesn't...

Paul T.

Cheryl said:
I have tried your method but it didn't seem to work
I am using a Pocket PC 2002 with Chinese support and with .NET cf installed

Jan Yeh said:
Hi,

Does your Pocket PC support Chinese?

You can check what was written into the text file
by opening it in Pocket Word.
If you found this file is full of question marks,
try to use "System.Text.Encoding.Unicode" in your
previous code.

Let me know if this helps!
--
Best Regards,
Jan Yeh

MCP, .NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan

Cheryl said:
I am sending a bytestream of Chinese characteratics through sockets.
I
need
to display the Chinese characters (possibly BIG5 words) in my Pocket PC.
How can I do that? The output only consists of question marks when I
implement the code below:

checkbox.Text = "";
String checkpath = @"\My Documents\~result.txt";
if (File.Exists(checkpath))
{
File.Delete(checkpath);
}
FileStream checkfs = File.Create(checkpath);
BinaryWriter checkw = new BinaryWriter
(checkfs,System.Text.Encoding.UTF8);

// Receive the transcribed text for verification first

byte[] bytes = new byte[resultClient.ReceiveBufferSize];
resultstream.Read(bytes,0,bytes.Length);
checkw.Write(bytes);
checkw.Close();

//Convert the bytes received to a string
String checking;

checkfs = new FileStream (checkpath,FileMode.Open,FileAccess.Read);
StreamReader checkr = new StreamReader(checkfs);

checking = checkr.ReadLine();
checkr.Close();

checkbox.Text = checking;
 
Back
Top