473,699 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unicode characters and System.Globaliz ation.CultureIn fo


I ran into a situation at work regarding unicode character encodings
and .NET cultures that left me a tad bit confused.

I was trying to instantiate a CultureInfo object from a locale
identifying a south chinese destination called the Hmong. Its usually
represented as hm-HMN. I peruse the NativeName property to extract
the name of the culture and display it on my application. When I do:

CultureInfo ci = new CultureInfo("hm-HMN");

ci.NativeName prints something that looks like this:

H'mong

However between the letter 'o' and 'n' I see what the unicode
consortium calls the replacement character (http://en.wikipedia.org/
wiki/Replacement_cha racter), which is basically a diamond with a
question mark inside it. Reading through that section on Replacement
Character in the wikipedia link it appears that the character appears
whenever the application is not able to decode the original byte
stream correctly and when it can't it replaces it with 0xfffd.

What I would like to know is what exactly is causing this problem?

1) Does the native windows API or whatever is called when I
instantiate a new CultureInfo (I haven't had a chance to reflector
into it yet) object encodes that character differently but .NET is not
able to display it because it is trying to decode it using UTF-16
rules?

2) Or is it because the character cannot be displayed because the
default code page is set at 1252?

Can anyone offer some insights on how to get it to display the
characters correctly and also clue me in on the differences between
encodings and code pages?

thanks!

Oct 15 '08 #1
0 2646

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

Similar topics

32
49704
by: Wolfgang Draxinger | last post by:
I understand that it is perfectly possible to store UTF-8 strings in a std::string, however doing so can cause some implicaions. E.g. you can't count the amount of characters by length() | size(). Instead one has to iterate through the string, parse all UTF-8 multibytes and count each multibyte as one character. To address this problem the GTKmm bindings for the GTK+ toolkit have implemented a own string class Glib::ustring...
5
5129
by: Borko | last post by:
hi I am having problems getting unicode characters into VB. Using VB6 (sp3) and Access 2000 Characters are displayed correctly in Access, just when I use ADODB (2.7) to read them in VB i get ? character instead of unicode characters. I will display them in TreeView (capable of Unicode) Is there any patch, fix or something, I know this thing is going around
14
3675
by: Jon Davis | last post by:
I have put my users through so much crap with this bug it is an absolute shame. I have a product that reads/writes RSS 2.0 documents, among other things. The RSS 2.0 spec mandates an en-US style of date formatting (RFC 822). I have been using a variation of RFC 1123 (just change the time zone to an offset, i.e. "-0800"). It seems to be writing okay, but it's failing to parse. I've tried changing the regional & language settings in my...
11
7232
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why only that I have to listen to them because they know it better. They told also that in a business situation it is better to use datetime.parseexact for changing cultures and not to use the globalization setting. I did not give them this sample,...
4
5247
by: LinasB | last post by:
Hi, How to read system setting value of "Language for non-Unicode programs" ? Or how to set it programmatically? LinasB
24
9056
by: ChaosKCW | last post by:
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special charcaters from an ASCII perspective. I get the following error: > SQLiteCur.execute(sql, row)
2
3135
by: jason | last post by:
DOTNET 2.0 VS 2005. My client is saying August 13,2006.. julian date should equal 225. Here's what I'm doing: <%@ Import Namespace="system.globalization" %> <script language="VB" runat="server">
1
1391
by: newpuritangrant | last post by:
All Apologies for the naivety of the following question, but how can one iterate over a Managed C++ String, and identify if any of the characters belong to a certain unicode range.? For example i would like to be able to identify if a managed string contains say Balinese characters (unicode range 1B00 to 1B7F). I would be extremely grateful for any help or references to a possible solution - Many thanks
0
1154
by: Jedediah Marcus | last post by:
I would like to parse a hebrew date into a System::DateTime variable: System::Globalization::CultureInfo ^CulInfo = gcnew System::Globalization::CultureInfo("he-IL"); CulInfo->DateTimeFormat->Calendar = gcnew System::Globalization::HebrewCalendar; CulInfo->DateTimeFormat->DateSeparator = " "; System::DateTime dt;
0
9172
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8908
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
8880
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...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4374
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
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
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
3
2008
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.