Solved

Replacing accent characters when reading writing csv files

Posted on 2008-10-10
6
1,615 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
Comment Utility
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
Comment Utility
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
Comment Utility
The HTML?  This is a csv to csv import/export.  It is never rendered to HTML
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Expert Comment

by:3abqari
Comment Utility
Yeah... sorry about that... my bad.
0
 
LVL 26

Expert Comment

by:Anurag Thakur
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now