473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Unicode and ASCII codes

Hi,

Dim strTmp as String

strTmp contains not only standart set of characters (ASCII codes from 1-127)
but also some of them from the extended ASCII table (128-255).

I need to output this string to the file - WHERE EVERY CHARACTER REPRESEND
BY 1 BITE.
(I do not want to be "loud" but this is very important in my question)
If I do such:

Dim stwFile as StreamWriter
stwFile = File.CreateText("Filename.txt")
stwFile.WriteLine(strTmp)

At such case opens file for writing UTF-8 encoded text.
then I will get file where everycharacter from lower table represended by 1
bite and from the extended table 2 bites.

If I change settings and will use such:
strFile = New StreamWriter("Filename.txt", False,
System.Text.Encoding.ASCII)
This case looks like decide the problem - every character represented by 1
bite but the characters from Extended table - converted to the '?'

Maybe somebody has an idea how I can get 1 bite per character and they will
be shown at the output file the same as I have them in String variable.

Thanks

P.S. The "problem" characters - characters of the French alphabet.
Nov 20 '05 #1
3 2074

Sounds like you want to use Encoding.Default.

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
Hi Mike,

There is a question in the newsgroup
microsoft.public.dotnet.general
from WEIWEIWEI and answered by Jon Skeet.

The question is different, however the answers could have been given to your
problem in my opinion.

It is not yet on Google I have seen, so you have to look for yourself.

I hope this helps,

Cor
Nov 20 '05 #3
Do your own conversion. Use BinaryWriter to write out individual bytes.

Hi,

Dim strTmp as String

strTmp contains not only standart set of characters (ASCII codes from 1-127)
but also some of them from the extended ASCII table (128-255).

I need to output this string to the file - WHERE EVERY CHARACTER REPRESEND
BY 1 BITE.
(I do not want to be "loud" but this is very important in my question)
If I do such:

Dim stwFile as StreamWriter
stwFile = File.CreateText("Filename.txt")
stwFile.WriteLine(strTmp)

At such case opens file for writing UTF-8 encoded text.
then I will get file where everycharacter from lower table represended by 1
bite and from the extended table 2 bites.

If I change settings and will use such:
strFile = New StreamWriter("Filename.txt", False,
System.Text.Encoding.ASCII)
This case looks like decide the problem - every character represented by 1
bite but the characters from Extended table - converted to the '?'

Maybe somebody has an idea how I can get 1 bite per character and they will
be shown at the output file the same as I have them in String variable.

Thanks

P.S. The "problem" characters - characters of the French alphabet.

Nov 20 '05 #4

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

Similar topics

6
by: nico | last post by:
In my python scripts, I use a lot of accented characters as I work in french. In order to do this, I put the line # -*- coding: UTF-8 -*- at the beginning of the script file. Then, when I need...
6
by: Spamtrap | last post by:
I only work in Perl occasionaly, and have been searching for a solution for a conversion, and everything I found seems much too complex. All I need to do is take a simple text file and copy...
13
by: Randell D. | last post by:
Folks, I have two related questions: 1. I have seen unicode being mentioned in my javascript pocket book - is this the same as ascii codes? I think not though I'm not sure and I can't find...
15
by: Craig Wagner | last post by:
I have a situation where I have a series of character codes stored in the database. In some cases they are the ASCII value of the character, in other cases they are the > 127 character code value...
2
by: Gidi | last post by:
Hi, I'm writing a C# win application program, and i need to transfer my hebrew letters from unicode to ascii, now if i use the ascii encoding it writes me ??? instead of the hebrew letter i've...
24
by: ChaosKCW | last post by:
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special...
14
by: abhi147 | last post by:
Hi , I want to convert an array of bytes like : {79,104,-37,-66,24,123,30,-26,-99,-8,80,-38,19,14,-127,-3} into Unicode character with ISO-8859-1 standard. Can anyone help me .. how should...
7
by: JTree | last post by:
Hi,all I encountered a problem when using unicode() function to fetch a webpage, I don't know why this happenned. My codes and error messages are: Code: #!/usr/bin/python #Filename: test.py...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
7
by: 7stud | last post by:
Based on this example and the error: ----- u_str = u"abc\u9999" print u_str UnicodeEncodeError: 'ascii' codec can't encode character u'\u9999' in position 3: ordinal not in range(128) ------
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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...

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.