473,772 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

upper 128 ASCII chars in a text file

As part of my ongoing effort to provide a set of .Net wrappers for DAO,
I'm writing a simple parser in VB.Net to search collection of VB6 source
files to add explicit qualifiers to existing variables

existing: dim DB as Database
...
DB(0)

new: DB.Tabledefs(0)

For the most part it's working, except that I've discovered that the
original authors of the VB6 code (my boss and the guy that I replaced)
have embedded upper 128 ASCII characters in the VB6 files, i.e., the
copyright symbol, etc. Most of them are included as part of a comment
somewhere, and so if I trash it it's not a big deal. However, there are
a couple that are actually embedded in a string literal as part of the
code - can't trash them.

I've mucked around with some of the various IO namespace file classes to
see if I could easily figure out how to handle this, but while I play, I
figured I'd ask if anyone else has encountered a similar problem and
come up with a solution that I could leverage? Google isn't helpful so far.

Thanks!

Sean
Nov 21 '05 #1
5 2415
Sean,

Normally that should not be a problem as well, depending that they have used
the characters that are local for you. Your name sounds quiet English so
probably is that the 1252

Have a look at those two links to get some insight in that.

Unicode
http://www.geocities.com/Athens/Acad.../fontset.htm#b

OS systems
http://www.microsoft.com/globaldev/r...ocversion.mspx

Otherwise have a look at 'Encoding" not encode in msdn.

http://search.microsoft.com/search/r...&c=0&s=1&swc=0

I hope this helps

Cor

"Sean Kirkpatrick" <na**********@c ommunity.nospam > schreef in bericht
news:OC******** *****@TK2MSFTNG P12.phx.gbl...
As part of my ongoing effort to provide a set of .Net wrappers for DAO,
I'm writing a simple parser in VB.Net to search collection of VB6 source
files to add explicit qualifiers to existing variables

existing: dim DB as Database
...
DB(0)

new: DB.Tabledefs(0)

For the most part it's working, except that I've discovered that the
original authors of the VB6 code (my boss and the guy that I replaced)
have embedded upper 128 ASCII characters in the VB6 files, i.e., the
copyright symbol, etc. Most of them are included as part of a comment
somewhere, and so if I trash it it's not a big deal. However, there are a
couple that are actually embedded in a string literal as part of the
code - can't trash them.

I've mucked around with some of the various IO namespace file classes to
see if I could easily figure out how to handle this, but while I play, I
figured I'd ask if anyone else has encountered a similar problem and come
up with a solution that I could leverage? Google isn't helpful so far.

Thanks!

Sean

Nov 21 '05 #2
Thanks, Cor.

I find that the characters are converted during the oReader.Readlin e -
they simply are not present in the string read from the file. Hence,
when I try to rewrite the converted file, they're not present there
either. It's obvious what's happened when I run a diff on original and
the converted.

Could it be that I'm using the wrong type of reader? The examples I've
seen show something like

Dim oReader As System.IO.Strea mReader =
System.IO.File. OpenText(psModu leName)

Sean


Cor Ligthert [MVP] wrote:
Sean,

Normally that should not be a problem as well, depending that they have used
the characters that are local for you. Your name sounds quiet English so
probably is that the 1252

Have a look at those two links to get some insight in that.

Unicode
http://www.geocities.com/Athens/Acad.../fontset.htm#b

OS systems
http://www.microsoft.com/globaldev/r...ocversion.mspx

Otherwise have a look at 'Encoding" not encode in msdn.

http://search.microsoft.com/search/r...&c=0&s=1&swc=0

I hope this helps

Cor

"Sean Kirkpatrick" <na**********@c ommunity.nospam > schreef in bericht
news:OC******** *****@TK2MSFTNG P12.phx.gbl...
As part of my ongoing effort to provide a set of .Net wrappers for DAO,
I'm writing a simple parser in VB.Net to search collection of VB6 source
files to add explicit qualifiers to existing variables

existing: dim DB as Database
...
DB(0)

new: DB.Tabledefs(0)

For the most part it's working, except that I've discovered that the
original authors of the VB6 code (my boss and the guy that I replaced)
have embedded upper 128 ASCII characters in the VB6 files, i.e., the
copyright symbol, etc. Most of them are included as part of a comment
somewhere, and so if I trash it it's not a big deal. However, there are a
couple that are actually embedded in a string literal as part of the
code - can't trash them.

I've mucked around with some of the various IO namespace file classes to
see if I could easily figure out how to handle this, but while I play, I
figured I'd ask if anyone else has encountered a similar problem and come
up with a solution that I could leverage? Google isn't helpful so far.

Thanks!

Sean


Nov 21 '05 #3
Yup, on input, it's throwing away anything above 127

my input line -> gvProductType1 = 1 ' comment with ® (174)

when read from the file, the ® is missing from the string variable used
in the input operation

sVar = oReader.Readlin e

Very strange - I thought the StreamReader could handle UTF-8 characters.

Sean

Sean Kirkpatrick wrote:
Thanks, Cor.

I find that the characters are converted during the oReader.Readlin e -
they simply are not present in the string read from the file. Hence,
when I try to rewrite the converted file, they're not present there
either. It's obvious what's happened when I run a diff on original and
the converted.

Could it be that I'm using the wrong type of reader? The examples I've
seen show something like

Dim oReader As System.IO.Strea mReader =
System.IO.File. OpenText(psModu leName)

Sean


Cor Ligthert [MVP] wrote:
Sean,

Normally that should not be a problem as well, depending that they
have used the characters that are local for you. Your name sounds
quiet English so probably is that the 1252

Have a look at those two links to get some insight in that.

Unicode
http://www.geocities.com/Athens/Acad.../fontset.htm#b

OS systems
http://www.microsoft.com/globaldev/r...ocversion.mspx

Otherwise have a look at 'Encoding" not encode in msdn.

http://search.microsoft.com/search/r...&c=0&s=1&swc=0
I hope this helps

Cor

"Sean Kirkpatrick" <na**********@c ommunity.nospam > schreef in bericht
news:OC******** *****@TK2MSFTNG P12.phx.gbl...
As part of my ongoing effort to provide a set of .Net wrappers for
DAO, I'm writing a simple parser in VB.Net to search collection of
VB6 source files to add explicit qualifiers to existing variables

existing: dim DB as Database
...
DB(0)

new: DB.Tabledefs(0)

For the most part it's working, except that I've discovered that the
original authors of the VB6 code (my boss and the guy that I
replaced) have embedded upper 128 ASCII characters in the VB6 files,
i.e., the copyright symbol, etc. Most of them are included as part of
a comment somewhere, and so if I trash it it's not a big deal.
However, there are a couple that are actually embedded in a string
literal as part of the code - can't trash them.

I've mucked around with some of the various IO namespace file classes
to see if I could easily figure out how to handle this, but while I
play, I figured I'd ask if anyone else has encountered a similar
problem and come up with a solution that I could leverage? Google
isn't helpful so far.

Thanks!

Sean


Nov 21 '05 #4
"Sean Kirkpatrick" <na**********@c ommunity.nospam > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..

Yup, on input, it's throwing away anything above 127
I didn't look at ADO stuff yet but the Encoding stuff has a pretty useless
default. Its default is ASCII which is one set of character assignments to
codepoints 0 through 127. (There is no such thing as upper 128 ASCII, you
mean upper 128 of some 256-character code page but you didn't say which code
page.)
my input line -> gvProductType1 = 1 ' comment with ® (174)

when read from the file, the ® is missing from the string variable used in
the input operation

sVar = oReader.Readlin e

Very strange - I thought the StreamReader could handle UTF-8 characters.


I think the Encoding stuff can be told to handle UTF-8 characters instead of
its default ASCII. But if you tell it to do so, I don't think you'll get
the results you expect. To the best of my understanding there is no
codepoint 174 in UTF-8, so that byte will be the first byte of a multibyte
character, and the result will either be invalid or some character different
from what you expected. You need to figure out which code page you want to
work with and tell the Encoding stuff to use your intended code page.

Nov 21 '05 #5
Sean,

I have the same idea as Norman about your question about the investigation
the used code page. Than you can normally always get your code with the
statement.

encoding.getenc oding

http://msdn.microsoft.com/library/de...dingtopic1.asp

I hope this helps,

Cor

"Sean Kirkpatrick" <na**********@c ommunity.nospam > schreef in bericht
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Yup, on input, it's throwing away anything above 127

my input line -> gvProductType1 = 1 ' comment with ® (174)

when read from the file, the ® is missing from the string variable used in
the input operation

sVar = oReader.Readlin e

Very strange - I thought the StreamReader could handle UTF-8 characters.

Sean

Sean Kirkpatrick wrote:
Thanks, Cor.

I find that the characters are converted during the oReader.Readlin e -
they simply are not present in the string read from the file. Hence, when
I try to rewrite the converted file, they're not present there either.
It's obvious what's happened when I run a diff on original and the
converted.

Could it be that I'm using the wrong type of reader? The examples I've
seen show something like

Dim oReader As System.IO.Strea mReader =
System.IO.File. OpenText(psModu leName)

Sean


Cor Ligthert [MVP] wrote:
Sean,

Normally that should not be a problem as well, depending that they have
used the characters that are local for you. Your name sounds quiet
English so probably is that the 1252

Have a look at those two links to get some insight in that.

Unicode
http://www.geocities.com/Athens/Acad.../fontset.htm#b

OS systems
http://www.microsoft.com/globaldev/r...ocversion.mspx

Otherwise have a look at 'Encoding" not encode in msdn.

http://search.microsoft.com/search/r...&c=0&s=1&swc=0

I hope this helps

Cor

"Sean Kirkpatrick" <na**********@c ommunity.nospam > schreef in bericht
news:OC******** *****@TK2MSFTNG P12.phx.gbl...

As part of my ongoing effort to provide a set of .Net wrappers for DAO,
I'm writing a simple parser in VB.Net to search collection of VB6
source files to add explicit qualifiers to existing variables

existing: dim DB as Database
...
DB(0)

new: DB.Tabledefs(0)

For the most part it's working, except that I've discovered that the
original authors of the VB6 code (my boss and the guy that I replaced)
have embedded upper 128 ASCII characters in the VB6 files, i.e., the
copyright symbol, etc. Most of them are included as part of a comment
somewhere, and so if I trash it it's not a big deal. However, there are
a couple that are actually embedded in a string literal as part of the
code - can't trash them.

I've mucked around with some of the various IO namespace file classes
to see if I could easily figure out how to handle this, but while I
play, I figured I'd ask if anyone else has encountered a similar
problem and come up with a solution that I could leverage? Google isn't
helpful so far.

Thanks!

Sean

Nov 21 '05 #6

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

Similar topics

1
2567
by: klappnase | last post by:
Hello everyone, there have already been a couple of threads about IDLE's sometimes annoying disability to use special characters (in my case I would like to use for example german umlauts like "ä" etc.). I have made a workaround that *seems* to work, so I can at least store files in the editor that use such characters ( on the python shell I still get: UnicodeError: ASCII encoding error: ordinal not in range(128)
4
6072
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3 script that grabs some web pages from the web, regex parse the data and stores it localy to xml file for further use.. at first i had no problem using python minidom and everything concerning
6
12558
by: Manish | last post by:
In my application there is need for only upper case chars.. Currently I am making entry to upper case when user leaves focus of the text control. I want to do some modification here...When user enters any char in small case...during that entry it should convert in upper case... It is very easy in VB6..In VB6 you just need to convert the Ascii value to char ---> then to Ucase ---> then char to Ascii again...this can be done in keypress...
5
3618
by: Gidi | last post by:
Hi, 1. I have a string that i want to write into a file. the string is build from few textboxs (str=text1+text2...), how can i write the string to the file in ASCII format? 2. I need my string will be 120 char length, and incase the string is less then 120 chars, i need to fill it with spaces till it will be 120 chars length, is there a better way then:
5
2619
by: Sia Jai Sung | last post by:
Hi, I have a class that I modify from a sample program, like below ========================================== Imports System Imports System.Web.UI Imports System.Security.Cryptography public Class CSoccerichCommonFunc
18
34146
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found Encoding.Convert, but that needs byte arrays. Thanks, /Ger
7
16197
by: Joris De Groote | last post by:
Hi, I have a 1 dimensional table byte with a number af characters in ASCII code. How do I convert those ASCII codes to real letters? Thanks
6
8662
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii chars. i'm assuming python has something like valid_str = strip(invalid_str)
4
25069
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. Anybody please help in c language. Thanks in Advance.
0
9619
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
9454
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,...
0
10103
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
9911
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...
0
8934
agi2029
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...
0
6713
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2850
bsmnconsultancy
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...

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.