?
Solved

Replacing accent characters when reading writing csv files

Posted on 2008-10-10
6
Medium Priority
?
1,626 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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