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 645663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:31:40+00:00 2026-05-13T21:31:40+00:00

I need to create an ANSI text file from an Access recordset that outputs

  • 0

I need to create an ANSI text file from an Access recordset that outputs to JSON and YAML. I can write the file, but the output is coming out with the original characters, and I need to escape them. For example, an umlaut-O (ö) should be “\u00f6”.

I thought encoding the file as UTF-8 would work, but it doesn’t. However, having looked at the file coding again, if you write “UTF-8 without BOM” then everything works.

Does anyone know how to either

a) Write text out as UTF-8 without BOM, or
b) Write in ANSI but escaping the non-ASCII characters?

Public Sub testoutput()

Set db = CurrentDb()

str_filename = "anothertest.json"
MyFile = CurrentProject.Path & "\" & str_filename
str_temp = "Hello world here is an ö"

fnum = FreeFile

Open MyFile For Output As fnum
Print #fnum, str_temp
Close #fnum

End Sub
  • 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-13T21:31:41+00:00Added an answer on May 13, 2026 at 9:31 pm

    … ok …. i found some example code on how to remove the BOM. I would have thought it would be possible to do this more elegantly when actually writing the text in the first place. Never mind. The following code removes the BOM.

    (This was originally posted by Simon Pedersen at http://www.imagemagick.org/discourse-server/viewtopic.php?f=8&t=12705)

    ' Removes the Byte Order Mark - BOM from a text file with UTF-8 encoding
    ' The BOM defines that the file was stored with an UTF-8 encoding.
    
    Public Function RemoveBOM(filePath)
    
        ' Create a reader and a writer
                Dim writer, reader, fileSize
                Set writer = CreateObject("Adodb.Stream")
                Set reader = CreateObject("Adodb.Stream")
    
        ' Load from the text file we just wrote
                reader.Open
                reader.LoadFromFile filePath
    
        ' Copy all data from reader to writer, except the BOM
                writer.Mode = 3
                writer.Type = 1
                writer.Open
                reader.Position = 5
                reader.CopyTo writer, -1
    
        ' Overwrite file
                writer.SaveToFile filePath, 2
    
        ' Return file name
                RemoveBOM = filePath
    
        ' Kill objects
                Set writer = Nothing
                Set reader = Nothing
        End Function
    

    It might be useful for someone else.

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

Sidebar

Related Questions

I need create clone repository. but I do not know where can I get
I need to create a C++ dll that will be called from another program
I need create a document word with Java. And I ask, how can I
I'm using Visual Studio 2008 and I need create a DataTable from a Excel
I need create custom tabbar with super class UITabBarController. But i don,t know how
I want add new user from another script and I need create password for
I need create a SQL Server stored procedure that does the following: Take an
Context What we need is to capture some user input (formatted text) from a
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution

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.