473,811 Members | 3,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I make C# Speak Spanish?

3 New Member
C will read a text file and store the Spanish characters (á, é, í, ó, ú, ñ, and ¿) as simple ASCII characters. No problem. C#, though, acts as if it's blind. The text string "bahía" read from a file comes out as "baha" and if I'm testing for spelling errors (I'm a Spanish teacher) it's no help. From what I can find on the Internet, the .NET system appears to render accented characters into more complex structures, but I can't find any examples or discussions about how to have C# read a Spanish string without omitting the accented characters. I tried loading the "using System.Globaliz ation" header and the code:
Expand|Select|Wrap|Line Numbers
  1. CultureInfo myCIintl = new CultureInfo("es", false);
  2. CultureInfo myCItrad = new CultureInfo( 0x000A, false ); 
but although their example code lines spit out information, nothing changed the omission of accented letters in my code's text reads.

I am using Windows XP home version and MS Visual Express 2005.

I would appreciate any suggestions.
Thanks.
Feb 27 '07 #1
4 3459
DeMan
1,806 Top Contributor
Is the problem that the characters are not DISPLAYED properly or not READ properly....?
Feb 28 '07 #2
norikus
3 New Member
[font=Verdana][size=2]I'm not sure. I don't know what sr.ReadLine has fetched until it shows with Console.WriteLi ne, so I don't know where the accented characters disappear.[/size][/font]

Is the problem that the characters are not DISPLAYED properly or not READ properly....?
Mar 1 '07 #3
DeMan
1,806 Top Contributor
Often you will find that the correct value is stored, but that the character set you are printing with doesn't support the character so it LOOKS like it's wrong (you might like to look up how to use different chaarcter sets).

Incedently (as a point of slight interest), this is how many cyber hackers/hijackers fool people into thinking they're at a site they're not -> the address is displayed without accents so all they need to do is use a similar address to what they want to pretend to be....internall y, the browser can tell the difference but the user can't.....
Mar 1 '07 #4
norikus
3 New Member
I found the answer. If the .txt file is saved as a UTF-8 file, the accented characters will be read by C#.
Mar 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2073
by: Richie Adler | last post by:
Does anyone know of a bitmap/resource/image collection for a Spanish card deck? I'm planning to create a new cardgame which requires this kind of deck (prototyping in Python and possible final development in Delphi; flames about my tool choices will be gently dropped into the bit bucket) I'd be very thankful about any information regarding this matter. -- o-=< Richie Adler >=-o
2
1869
by: poisondart | last post by:
Is there a predefined entity set for Spanish accents? I know that I could just easily make one, except that I intend to do this for other languages in the future, which may have more accents than Spanish. The closest to what I was expecting was this link: http://www.altheim.com/specs/charents.html ....but the link to the ent file is broken. What is the usual/preferred method that you employ to render special
2
1818
by: Robert | last post by:
I would like to know how others are developing multilingual apps for US Spanish-speaking public. If an app is globalized and es-MX is used for the culture, won't the currency, dates, etc.. show up as in Mexico where an app written for Spanish-speaking US would still want date and currency to appear as $ and mm/dd/yy, but use the culture to move all text to Spanish? Before I roll my own solution for this, I'm curious how others are...
0
1373
by: Rocky | last post by:
I am looking for a legal copy of Microsoft Office 97 Developer Edition in Spanish. I have been developing with Access 97 Developer Edition in U.S. English for 5 years but am now translating a software program to Spanish. I need the Spanish Access 97 Office Developer Edition so that runtime errors, message boxes, and formatting messages will be in Spanish rather than English. If anyone knows of a resource to find this software...
3
1471
by: charliewest | last post by:
I realize this most likely isn't the right newsgroup, but i'm having troube finding anyswers: I'm working with MS C# .NET 2003 Professional Edition on a machine that was set to regional settings of SPAIN. As such, when i dragged and dropped the calendar and repeater controls to the ASP.NET web form, the control appeared in Spanish at design time. I've changed my regional settings to US (default), i've restarted my
0
1316
by: Garth17 | last post by:
This totally surprised me. I'm using IE 6. I built a really simple test.aspx page that had a javascript block in it like this: <script language=javascript src="spanish.js"></script> Inside the spanish.js I had 1 line that set a variable to a spanish character. var Test = "á";
3
5129
by: Chip | last post by:
There is surprisingly little information on the various encoding options for reading a text file. I have what seems to be a very basic issue: I'm reading a text file that includes Spanish characters such as "ñ". When I read the file into a string, that character is missing. Encoding seems to be the culprit. File writers SHOULD begin a file with the BOM (Byte Order Mark) to let us know what encoding to read the file with, but most software...
1
3248
by: jackal_on_work | last post by:
Hi, I have a database and want to store data in Spanish and English. To accompish this: 1. Do i need to create separate tables for both the languages like items_en and items_sp? 2. If I opt for the UTF16 charset what single collation setting can I use?
2
1803
by: paragdi | last post by:
Hi Experts! I am developing heavy mathematical engineering windows application in VB.NET (VS2005) with MSAccess Db. This application has resource files in English, Spanish and German Language. I have same setup to run in all these 3environment Windows XPs. In English, calculations are perfect; but in Spanish ',' is treated as '.' and '.' is treated as ',' e.g. 12.24 in EN is '12,24' in Spanish. I somehow managed to do it by manually...
0
9730
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10651
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
10392
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...
0
10136
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
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
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
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
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.