473,794 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying a unicode character

Hi,
I'm just trying to do something very simple, but I can't find a simple
example. In a TextBox and Button on a WinForm, I just want to display some
Unicode characters -- specifically, U+2660, U+2663, U+2665 and U+2666 (the
playing card symbols).

It's my understanding that all strings is .NET are unicode strings. Is that
correct?

Currently I have the unicode characters as input to some strings:
E.g.

string s = "*♣♥ "; // weird, this text box doesn't recognize the diamond
symbol

Then, I simply want to display those characters in a textbox:

textBox1.Append Text(s);

So, what other steps along the way do I need to do?

Thanks,
Nov 22 '05 #1
2 2713
Quimbly <Qu*****@discus sions.microsoft .com> wrote:
I'm just trying to do something very simple, but I can't find a simple
example. In a TextBox and Button on a WinForm, I just want to display some
Unicode characters -- specifically, U+2660, U+2663, U+2665 and U+2666 (the
playing card symbols).

It's my understanding that all strings is .NET are unicode strings. Is that
correct?

Currently I have the unicode characters as input to some strings:
E.g.

string s = "????"; // weird, this text box doesn't recognize the diamond
symbol

Then, I simply want to display those characters in a textbox:

textBox1.Append Text(s);

So, what other steps along the way do I need to do?


Set the font to one which supports those symbols. You might want to use
CharMap to work that out.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 22 '05 #2
> string s = "*♣♥ ";
Try string s = "\u2660\u2663\u 2665\u2666";
The strings are Unicode, but your source file is not.

--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
Nov 22 '05 #3

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

Similar topics

6
2785
by: S. | last post by:
if in my website i am using the sgml { notation, is it accurate to say to my users that the site uses unicode or that it requires unicode? is there a mathematical formula to calculate a unicode value given its utf8 value? Rgds, Sam
4
2633
by: Sam | last post by:
Is there a way to display Asian fonts in Access 97? If not, how about subsequent versions? One thought is I was able to display Asian fonts in Visual Basic using a browser control, which in turn could display unicode fonts. Is this option available in Access 97 or other versions? Any help or information in this area would be much appreciated. thanks in advance, Sam90
3
5470
by: Kidus Yared | last post by:
I am having a problem displaying Unicode characters on my Forms labels and buttons. After coding Button1.Text = unicode; where the unicode is a Unicode character or string (‘\u1234’ or “\u1234”) It seems to work the first time I set the button to the Unicode character. After a while, when saving my code, I get a pop-up window stating that I need to save the file as a Unicode else my changes will not be saved. Seance I do not want...
0
1462
by: Coco | last post by:
Hi! I have been searching for solution for the problem i am facing in displaying chinese character in my aspx page initially when i created the aspx page with some chinese chaarcter, it worked perfectly, but i am having problem when setting the label of my page to some chinese character during run-time which i do it from the code behind i realize the chinese will displayed correctly if i opened
6
2015
by: Jonas | last post by:
Hi! I'm developing an ASP.NET application that fetches Unicode string data from a SQL Server. I'm using "Lucinda Sans Unicode" as the font for my web pages but when I have a string containing the subscripted character "2" (as in CO2), I get the box character instead. This is a problem only in Internet Explorer, because if I try my web page in Firefox, it shows the character in a correct fashion. I've tried to use the Server.HTMLEncode...
13
3315
by: Toms | last post by:
Let's start off with: class Nation { public: virtual const char* GetName() const = 0; } class Norway : public Nation { public: virtual const char* GetName() const
7
4026
by: 7stud | last post by:
Based on this example and the error: ----- u_str = u"abc\u9999" print u_str UnicodeEncodeError: 'ascii' codec can't encode character u'\u9999' in position 3: ordinal not in range(128) ------
5
5471
by: tushar.saxena | last post by:
This post is a follow up to the post at : http://groups.google.com/group/comp.lang.c++/browse_thread/thread/83af6123fa945e8b?hl=ug#9eaa6fab5622424e as my original question was answered there, but I have some additional problems now. Basically what I want to do is : Given an input UTF-8 encoded file containing HTML sequences such as "&amp;", I want to be able to replace these sequences with their UTF-8 representations (i.e. "&") What I...
3
1693
by: gregpinero | last post by:
I want to make a little Python utility where a user can enter the unicode numerical code and get the actual symbol back in utf-8. For example, a user could enter something like u221E And get back $B!g(B Now, this does seem to work: $B!g(B
3
1276
by: =?Utf-8?B?UmljaA==?= | last post by:
I copied a down arrow triangle symbol from the character map and added this symbol to a menu Item on a menustrip on a form in my app. On saving the project a dialogbox asked if I wanted to convert/save to unicode - or something like that. I clicked yes and then deployed the app (using Click Once). On a user's workstation I noticed that this triangle symbol was not displaying and in its place was a little empty sqare (indicating the...
0
9671
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10161
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.