Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Replacing accent characters when reading writing csv files

Posted on 2008-10-10
6
Medium Priority
?
1,630 Views
Last Modified: 2013-11-07
I am reading "certain" field values from several different csv files and combining these files into 1 csv file.  I have to format the values slightly before I add them to my master csv file because it will eventually be imported into SQL at a later date, mainly I just need to truncate the values so that the SQL import process won't complain.

The problem I am running into is when a value has accent characters.  For instance I have a value of
LA CITÉ.  So one of the things I do is replace É with E and if I MessageBox this, it works just as expeced.  However when I look at the master file after all the files have been processed, the value that actually got saved is LA CITÃ0 rather than LA CITE.

Any idea why this is happening and what I can do about it?  I am on .NET 1.1
0
Comment
Question by:GaryRasmussen
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:GaryRasmussen
ID: 22688402
I was wondering how those characters would show up in the question.  Where it says LA CITA0 in the last line, the A in CITA actually has a tilde over the top of it and the 0 in CITA is actually a fraction 0/00

Thanks!
0
 
LVL 3

Expert Comment

by:3abqari
ID: 22688510
I think that will depend on the Character Encoding tag that you put in the html:

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

I don't know exactly how you change it in C#'s .ascx or aspx files.
0
 
LVL 1

Author Comment

by:GaryRasmussen
ID: 22688542
The HTML?  This is a csv to csv import/export.  It is never rendered to HTML
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Expert Comment

by:3abqari
ID: 22688557
Yeah... sorry about that... my bad.
0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22689012
is the following link going to be of any help to you
http://blogs.msdn.com/michkap/archive/2005/02/19/376617.aspx
0
 
LVL 1

Accepted Solution

by:
GaryRasmussen earned 0 total points
ID: 22689105
Thanks,

I read that one last night.  Unfortunately NormalizedString is only avaialble in .NET 2.0 and my application is .NET 1.1

I think the main issue here is that even when I look at the data in say Notepad and it looks like an E with an accent over the top of it, that is not neccessarily what the actual characters are because when the datatable reads the same value, it reads it as having other characters so there is no way to determine ahead of time what the actual string value is.

What is worse is that using substring to truncate the string doesn't work either because it treats the 4 chars that make up the single char as 1 character so the string does not get truncated to the correct length.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question