I’m using textfieldparser to read a data file. which contains, for example:
Amondó Szegi Amondo Szegi
andré nossek André Nossek
© Characte Character
Note the vowels with diacriticals and the copyright symbol - it is dropping
these (and other similar) characters which fall outside ascii range
(apparently)
The code is simple and looks like:
Using MyReader As New TextFieldParser (Application.St artupPath &
"\designers.txt ")
MyReader.TextFi eldType = FileIO.FieldTyp e.Delimited
MyReader.Commen tTokens = New String() {"#"}
MyReader.Delimi ters = New String() {vbTab}
MyReader.TrimWh iteSpace = True
Dim currentRow As String()
intElement = 0
While Not MyReader.EndOfD ata
Try
currentRow = MyReader.ReadFi elds()
If Microsoft.Visua lBasic.Left(cur rentRow(0), 7) =
"UNKNOWN" Then
strUnknownDesig ner = currentRow(1)
Continue While
End If
arDesigner(intE lement, 0) = currentRow(0)
arDesigner(intE lement, 1) = currentRow(1)
arDesignerCount er(intElement) = 0
intElement += 1
Catch ex As MalformedLineEx ception
MsgBox("Designe r Line " & ex.Message & "is not valid
and will be skipped.")
End Try
End While
End Using
I can’t see any reason in the documentation for it dropping copyright or
the French and German (etc…) vowels with accents.
Comments or suggestions anyone??
Thanks //al 3 6733
al jones wrote:
I'm using textfieldparser to read a data file. which contains, for
example:
Amondó Szegi Amondo Szegi
andré nossek André Nossek
© Characte Character
Note the vowels with diacriticals and the copyright symbol - it is
dropping these (and other similar) characters which fall outside
ascii range (apparently)
It appears to be an encoding problem where the file uses (I'm guessing)
ISO-8859-1 or maybe Windows-1252 whereas the .NET framework defaults to
Unicode. Does a TextFieldParser have a setting for that (or have a
..BaseClass that does)?
Or perhaps you can arrange for the file to be encoded with Unicode?
Andrew
On Thu, 21 Sep 2006 13:02:59 +0100, Andrew Morton wrote:
al jones wrote:
>I'm using textfieldparser to read a data file. which contains, for example:
Amondó Szegi Amondo Szegi andré nossek André Nossek © Characte Character
Note the vowels with diacriticals and the copyright symbol - it is dropping these (and other similar) characters which fall outside ascii range (apparently)
It appears to be an encoding problem where the file uses (I'm guessing)
ISO-8859-1 or maybe Windows-1252 whereas the .NET framework defaults to
Unicode. Does a TextFieldParser have a setting for that (or have a
.BaseClass that does)?
Or perhaps you can arrange for the file to be encoded with Unicode?
Andrew
Possibly my confusion is from the fact that I maintain these files (there
are three of them) within VS 2005 so I would have epected them to be
unicode. The characters exist within the files (the three line examples are
cut & paste from the file itself) so I don't understand why reading them
would literally eliminate the characters.
I've been over the TextFieldParser docs and see nothing that indicates that
it shouldn't take the data as presented.
Try OrchidGrid control, which can pase/import data from delimited files.
I¡¯m using textfieldparser to read a data file. which contains, for
example:
Amond¨® Szegi Amondo Szegi
andr¨¦ nossek Andr¨¦ Nossek
? Characte Character
Note the vowels with diacriticals and the copyright symbol - it is
dropping
these (and other similar) characters which fall outside ascii range
(apparently)
The code is simple and looks like:
Using MyReader As New TextFieldParser (Application.St artupPath &
"\designers.txt ")
MyReader.TextFi eldType = FileIO.FieldTyp e.Delimited
MyReader.Commen tTokens = New String() {"#"}
MyReader.Delimi ters = New String() {vbTab}
MyReader.TrimWh iteSpace = True
Dim currentRow As String()
intElement = 0
While Not MyReader.EndOfD ata
Try
currentRow = MyReader.ReadFi elds()
If Microsoft.Visua lBasic.Left(cur rentRow(0), 7) =
"UNKNOWN" Then
strUnknownDesig ner = currentRow(1)
Continue While
End If
arDesigner(intE lement, 0) = currentRow(0)
arDesigner(intE lement, 1) = currentRow(1)
arDesignerCount er(intElement) = 0
intElement += 1
Catch ex As MalformedLineEx ception
MsgBox("Designe r Line " & ex.Message & "is not valid
and will be skipped.")
End Try
End While
End Using
I can¡¯t see any reason in the documentation for it dropping copyright or
the French and German (etc¡*) vowels with accents.
Comments or suggestions anyone??
Thanks //al
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hilary Cotter |
last post by:
Thanks for all the help you gave me yesterday.
here is another question.
I have a comma delimited file called redirect.txt which looks like
this
test, /test.htm
test 123,/test123.htm
|
by: ungvichian |
last post by:
So, right now I'm writing a program in VC++.Net with MFC, and one of
the steps involves reading numeric values from a comma delimited file
(like 4.56, 2.44, 3.453 etc.). The only methods I've been able to find
to read the values all involve StreamReader, and I can't figure out how
to use this. Since I'm using MFC, I'm using CFile instead.
Also, none of the methods seem to come with a method for error
catching. I want my program to be...
|
by: svijay |
last post by:
hi
I have got a strange problem. May I know any solution for this.
Here is the detailed description about the problem
We have got a mainframe system and also production and development
server.
|
by: Jim |
last post by:
..net newbie
I'm trying to read using TextFieldParser because my input file needs to
be parsed. Works fine. I can display the data in a msg box. Now I
want to write that data to a text file including a cr/lf at the end.
The trouble I'm having is converting currentRow to sting. The error I
get relates to the fact that its defined as an array and vb says it
can't convert it to text.
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
'--this code works but only reads text into one column when contains multiple
cols
Dim ds1x As New DataSet
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dir1A\;Extended
Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn1x As New OleDb.OleDbConnection(ConStr)
Dim dax1 As New OleDbDataAdapter("Select * from testabc1x.txt", conn1x)
| |
by: jwwicks |
last post by:
Hello All,
This is a student assignment. So I don't want the complete answer just a hint or maybe a bumb on the head cause I'm doing it the wrong way. Assume I haven't done anything braindead like not include a header etc... I can post the whole code if you like/need it but I'm trying to spare the forum :)
Got a product structure...
struct product {
string id;
string description;
int quantity;
|
by: tshad |
last post by:
I have a program that is reading a csv file into a dataset. I want it to
read the 1st line as data. But it ignores it.
I have the Connection set up as:
OleDbConnection csvConnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
csvPath + ";Extended
Properties=\"Text;HDR=Yes;FMT=Delimited\"");
|
by: Yearwood |
last post by:
Hi, I'm basically trying to import a CSV into an ACCESS database. Sample date is shown below:
"",10173,"Development Manager - Social Economy Sector","Trust Bank",10153,,"Lolalll Pudd","Meet the requirements of Structured Finance & Relationship Teams for "transaction support" at all times, ensuring appropriate analysis and clarity in respect of required/request","",09-Sep-2008,42000,38000,"+ LTA +...
|
by: pakerly |
last post by:
How would i do this, convert a test file to excel?
Lets say my text file has fields like this:
NUMBER NAME ADDRESS PHONE
11002 Test1 TestAddress1 111-2222
lets say the number field is 10 characters long, there is a space and
Name field is 15 characters long, there is a space, address can be 25
characters long, there is a space and phone is 10 characters long
I want to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
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...
| |