Unicode and ASCII codes

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Mike (please_at_no.spam)
Date: 04/16/04


Date: Thu, 15 Apr 2004 21:08:46 -0400

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.



Relevant Pages

  • Re: How to convert Infix notation to postfix notation
    ... If this is for an error message, why isn't it using stderr for its output? ... array of 15 characters, and you call this function with the limit 15 on ... Making sure that the only string I allocate and append to, ... because mulFactor in all versions must needs incorporate the functions ...
    (comp.lang.c)
  • Re: Prothon should not borrow Python strings!
    ... """It does not make sense to have a string without knowing what encoding ... same cul de sac as Python. ... Prothon_String_As_ASCII // raises error if there are high characters ... Python's split between byte strings and Unicode strings is ...
    (comp.lang.python)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... put them in stupid places. ... Programming is difficult (as you must surely appreciate, ... > strings will be in the range 1...1000 characters. ... impose an artificially small limit on string length." ...
    (comp.programming)
  • Re: Fast UTF-8 strlen function
    ... >> Is there a fast UTF-8 string length function floating around? ... Length in bytes, or length in characters? ... For UTF-8, the main basic "change" you have to make to your string routines ... then I could individually look up the characters in my UNICODE ...
    (alt.lang.asm)
  • Re: Byte Array to String
    ... retrieved text will mismatch the original characters. ... encoding the characters. ... Dim strFileData as String ...
    (microsoft.public.dotnet.framework.aspnet)