Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6332721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:19:06+00:00 2026-05-24T18:19:06+00:00

I’m having a problem trying to output the content of some variables in vb6

  • 0

I’m having a problem trying to output the content of some variables in vb6 into a text file. The thing is that when a special character from extended ASCII appears as ä, ü, á it is transformed in the output to the matching basic ASCII char like a, u, a.

I’ve tried to export it like UTF-8 and then the character is shown correctly, but I need the output to be ASCII. Also, looks strange for me that the filename can normally contain this chars (ä, ü, á…) without sustitution.

Can this be because “ASCII” charset is just the basic and not the extended? Maybe because of the CodePages configured in Windows? I’ve tried with a couple of them (German, English) with the same result.

This is the code I’m using:

Set fileStream = New ADODB.Stream
If Not fileStream Is Nothing Then
    inputString = textPreAppend + inputString
    fileStream.charSet = "ASCII"
    fileStream.Open
    fileStream.WriteText inputString
    fileStream.Flush
    fileStream.SaveToFile fileName, adSaveCreateOverWrite
    fileStream.Flush
    fileStream.Close
End If
Set fileStream = Nothing

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:19:07+00:00Added an answer on May 24, 2026 at 6:19 pm

    Both PRB: Charset Property of ADO Stream Object May Require Microsoft Internet Explorer Upgrade and Charset Property (ADO) suggest that ADO CharSet values are those listed under HKEY_CLASSES_ROOT\MIME\Database\Charset but that clearly is not the entire story.

    For example both values “ascii” and “us-ascii” are listed there as aliases of “iso-8859-1” however running with my locale set to U.S. English they act like a 7-bit ASCII MIME type. They’d almost have to, since there is nothing else provided for requesting 7-bit ASCII encoding anyway.

    This produces the result you seem to want:

    Option Explicit
    
    Private Sub Main()
        Dim fileStream As ADODB.Stream
        Dim inputString As String
        Const FileName As String = "outputfile.txt"
    
        Set fileStream = New ADODB.Stream
        inputString = "The thing is that when a special character" & vbNewLine _
                    & "from extended ASCII appears as ä, ü, á it" & vbNewLine _
                    & "is transformed in the output to the matching" & vbNewLine _
                    & "basic ASCII char like a, u, a." & vbNewLine
        With fileStream
            .Type = adTypeText
            .Charset = "iso-8859-1"
            .Open
            .WriteText inputString
            .SaveToFile FileName, adSaveCreateOverWrite
            .Close
        End With
    End Sub
    

    Output:

    The thing is that when a special character
    from extended ASCII appears as ä, ü, á it
    is transformed in the output to the matching
    basic ASCII char like a, u, a.
    

    We have to assume that asking for “ascii” (the values are all lowercased though clearly are not case-sensitive) means 7-bit ASCII, perhaps localized.

    Using UTF-8 is a bad idea unless you want UTF-8. While a lot of *nix systems pretend there is no difference, the Stream will write a BOM and of course those extended (non-ASCII) characters are multibyte encoded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.