473,394 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

c# unicode question



--
Hi,all
if i wirte
string str =
"\u6570\u636e\u5e93\u64cd\u4f5c\u95ee\u9898\uff0c\ u8bf7\u60a8\u91cd\u65b0\u7
67b\u5f55\uff01";
dotNet can recognize as unicode ,and when i console.write() it , it can
show right chinese words.
but if i read this sentence from TextBox,dotNet will add @ , like str=
@"\u6570...";
When i console.write() ,i only can see "\u6570..." but not chinese words.

So,

is there any way to convert the string added @ to normal string ?
or i have to write a function to read every char and re-write to another
string ?

thx very much

Best Regards,
Yang,Jun ya***@blrcsv.china.bell-labs.com
Nov 17 '05 #1
2 7698
> dotNet will add @ , like str= @"\u6570...";

This will happen if you are setting the "Text" property using a designer since the PropertiesGrid control (used by VS.NET) will not
take escaped strings as input. Instead, set the property in code.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Yang,Jun" <ya***@blrcsv.china.bell-labs.com> wrote in message news:O$****************@TK2MSFTNGP10.phx.gbl...


--
Hi,all
if i wirte
string str =
"\u6570\u636e\u5e93\u64cd\u4f5c\u95ee\u9898\uff0c\ u8bf7\u60a8\u91cd\u65b0\u7
67b\u5f55\uff01";
dotNet can recognize as unicode ,and when i console.write() it , it can
show right chinese words.
but if i read this sentence from TextBox,dotNet will add @ , like str=
@"\u6570...";
When i console.write() ,i only can see "\u6570..." but not chinese words.

So,

is there any way to convert the string added @ to normal string ?
or i have to write a function to read every char and re-write to another
string ?

thx very much

Best Regards,
Yang,Jun ya***@blrcsv.china.bell-labs.com

Nov 17 '05 #2
Yang,Jun <ya***@blrcsv.china.bell-labs.com> wrote:
Hi,all
if i wirte
string str =
"\u6570\u636e\u5e93\u64cd\u4f5c\u95ee\u9898\uff0c\ u8bf7\u60a8\u91cd\u65b0\u7
67b\u5f55\uff01";
dotNet can recognize as unicode ,and when i console.write() it , it can
show right chinese words.
but if i read this sentence from TextBox,dotNet will add @ , like str=
@"\u6570...";
When i console.write() ,i only can see "\u6570..." but not chinese words.


Nope, it works fine in a textbox too - but only if you have the code
above. If you use the designer, you can't use the escape mechanisms as
above; it will automatically escape things for you.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: sebastien.hugues | last post by:
Hi I would like to retrieve the application data directory path of the logged user on windows XP. To achieve this goal i use the environment variable APPDATA. The logged user has this name:...
9
by: François Pinard | last post by:
Hi, people. I hope someone would like to enlighten me. For any application handling Unicode internally, I'm usually careful at properly converting those Unicode strings into 8-bit strings before...
27
by: EU citizen | last post by:
Do web pages have to be created in unicode in order to use UTF-8 encoding? If so, can anyone name a free application which I can use under Windows 98 to create web pages?
3
by: Supratim | last post by:
Hi, For past few weeks I am working on a function that would take encoded Unicode characters from query string of http requests and then decode them back to Unicode numbers. I have full success...
3
by: dalei | last post by:
My question is presented more clearly in following web page: http://www.pinyinology.com/signs2.html <html> HTML entities display outside script tags: a&sup1;, a&sup2;, a&sup3;, a⁴ But...
12
by: damjan | last post by:
This may look like a silly question to someone, but the more I try to understand Unicode the more lost I feel. To say that I am not a beginner C++ programmer, only had no need to delve into...
14
by: abhi147 | last post by:
Hi , I want to convert an array of bytes like : {79,104,-37,-66,24,123,30,-26,-99,-8,80,-38,19,14,-127,-3} into Unicode character with ISO-8859-1 standard. Can anyone help me .. how should...
2
by: willie | last post by:
Martin v. Löwis: Thanks for the thorough explanation. One last question about terminology then I'll go away :) What is the proper way to describe "ustr" below? <type 'unicode'>
5
by: =?Utf-8?B?S2V2aW4gVGFuZw==?= | last post by:
In MFC, CRichEditCtrl contrl, I want to set the codepage for the control to Unicode. I used the following method to set codepage for it (only for ANSI or BIG5, etc, not unicode). How should I...
0
by: deloford | last post by:
Hi This is going to be a question for anyone who is an expert in C# Text Encoding. My situation is this: I have a Sybase database which is firing back ISO-8559 encoded strings. I am unable to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.