473,761 Members | 9,379 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading a not UTF-8 encoding file

Hi,

I try to read a file that have 8 bit character, but contain some
character
whose code is more than 128 (spanish character).

When I read this file using ASCII (Dim oRead As StreamReader = New
StreamReader("C :\...\name.txt" , System.Text.Enc oding.ASCII)), this
special characters aren't appear.

If I try red this file with some unicode like UTF-8(the defualt
encodign for the OpenText() ) of course that did't work, because of
this character don't have 16 bit.
I'm not an expert of unicode matter.

Can someone help me reading this type of file for show his content in
web page.

Thank

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #1
3 2348

Try using Encoding.Defaul t, that's your default ANSI code page.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #2
Cor
Hi Leticia,

ASCII is 7 bit.

You have to use the Unicode. But I asume you are working in Spanish, why you
want to encode a Spanish characterset to a Spanish characterset?

Cor

When I read this file using ASCII (Dim oRead As StreamReader = New
StreamReader("C :\...\name.txt" , System.Text.Enc oding.ASCII)), this
special characters aren't appear.

If I try red this file with some unicode like UTF-8(the defualt
encodign for the OpenText() ) of course that did't work, because of
this character don't have 16 bit.
I'm not an expert of unicode matter.

Nov 20 '05 #3
Hello, leticia:

If the file was written in Windows it has probably ANSI encoding:
Dim oRead As StreamReader = New StreamReader("C :\...\name.txt" , System.Text.Enc oding.Default)

If it was written in DOS it was probably encoded with codepage 850:
Dim oRead As StreamReader = _
New StreamReader("C :\...\name.txt" , New System.Text.Enc oding(850))

If it was encoded with other codepage, substitute 850 with the codepage number. For example, US codepage is 437.

Regards.
"leticia larrosa" <le*********@ya hoo-dot-com.no-spam.invalid> escribió en el mensaje news:40******** **@127.0.0.1...
| Hi,
|
| I try to read a file that have 8 bit character, but contain some
| character
| whose code is more than 128 (spanish character).
|
| When I read this file using ASCII (Dim oRead As StreamReader = New
| StreamReader("C :\...\name.txt" , System.Text.Enc oding.ASCII)), this
| special characters aren't appear.
|
| If I try red this file with some unicode like UTF-8(the defualt
| encodign for the OpenText() ) of course that did't work, because of
| this character don't have 16 bit.
| I'm not an expert of unicode matter.
|
| Can someone help me reading this type of file for show his content in
| web page.
|
| Thank

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
5739
by: Haines Brown | last post by:
I'm having trouble finding the character entity for the French abbreviation for "number" (capital N followed by a small supercript o, period). My references are not listing it. Where would I find an answer to this question (don't find it in the W3C_char_entities document). -- Haines Brown brownh@hartford-hwp.com
16
6171
by: lawrence | last post by:
I was told in another newsgroup (about XML, I was wondering how to control user input) that most modern browsers empower the designer to cast the user created input to a particular character encoding. This arose in answer to my question about how to control user input. I had complained that I had users who wrote articles in Microsoft Word or WordPerfect and then input that to the web through a textarea box on a form I'd created. I've...
7
3081
by: saroj.yadav | last post by:
As I understand it (correct me, if I am wrong) Unicode came into picture so that a document containing multiple language characters can be supported like somebody can write a document comparing Korean and Chinese in French language. Now, I am looking at all UNIX platforms and seems like all Unix (AIX, HP, Solaris) platforms support Unicode by supporting language/region specific UTF-8 locales like fr_FR.UTF-8, ja_JP.UTF-8, ko_KR.UTF-8...
3
2149
by: [Yosi] | last post by:
I have some unreasonable issue while reading access component from other thread. I have a Form class which includes TreeView, this tree view includes some TreeNodes , lets say 2 . In my Form class I define an arraylist which include reference to those TreeNodes. ArayList myTNodesPackage (define ...) myTNodesPackage.Add….
5
1720
by: ltt19 | last post by:
Hi, I want to read line by line in a variable, but it could not be foward only , it need to be forward and backward, it also needs to say me which line it is reading. I do not know if it is possible. Thanks in advance ltt19
23
8203
by: Steven T. Hatton | last post by:
This is one of the first obstacles I encountered when getting started with C++. I found that everybody had their own idea of what a string is. There was std::string, QString, xercesc::XMLString, etc. There are also char, wchar_t, QChar, XMLCh, etc., for character representation. Coming from Java where a String is a String is a String, that was quite a shock. Well, I'm back to looking at this, and it still isn't pretty. I've found...
7
12151
by: Jimmy Shaw | last post by:
Hi everybody, Is there any SIMPLE way to convert from UTF-16 to UTF-32? I may be mixed up, but is it possible that all UTF-16 "code points" that are 16 bits long appear just the same in UTF-32, but with zero padding and hence no real conversion is necessary? If I am completely wrong and some intricate conversion operation needs to take place, can anyone give me some primer on the subject?
1
2548
by: tamoochin | last post by:
I have a form that registers the user with my website, the form is in farsi language and must use utf-8 standard. I can store data in MS Access and also read it back with any problems. the characters are correct in database too. but when I want to search a user in my asp search form, the "not found" phrase displayed! any keyword I use to search like username or name or city will fail. but when I edit the user profile with my asp edit...
0
1140
by: Leon zhang | last post by:
#!/usr/bin/env python # -*- coding: utf-8 -*- import string, sys from threading import Thread import os import time class test_pipe(Thread): def __init__(self, fd):
1
1173
by: Roshawn | last post by:
Hi, I'm an affiliate of several online merchants. These merchants all offer data feeds to their affiliates and I'm desirous to work with them. However, these feeds are gzipped (.gz file extension). I don't know what to do. The merchants don't offer their feeds in xml as that would make them too verbose. How do I go about reading .gz files in ASP.NET? Thanks,
0
9522
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
10111
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
9948
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
9765
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...
1
7327
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
6603
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();...
0
5215
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...
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.