Acces 365 - Export Specifications - No UTF-8 with BOM? (1 Viewer)

EzGoingKev

Registered User.
Local time
Today, 08:25
Joined
Nov 8, 2019
Messages
178
Good evening.

I am exporting some text out of Access and I wanted to setup a specification that would do it as UTF-8 with BOM. In the Code Page drop down there is Unicode (UTF-8) but no selection for UTF-8 with BOM.

Is there a way to set these files up to export as UTF-8 with BOM?
 

Isaac

Lifelong Learner
Local time
Today, 05:25
Joined
Mar 14, 2017
Messages
8,738
A workaround may be, in code, open the file immediately after it's created - read the contents into memory - create a new text file, and Write to it ChrW(65279) plus the original contents.

air code, untested, other than i did test that this puts the correct BOM there

Diff:
dim fso as object, ts as object, strOld as string, strNew as string
set fso=createobject("scripting.filesystemobject")
set ts=fso.opentextfile("path to file1",1,false,-1)
strOld=ts.readall
ts.close
set ts=nothing
set ts=fso.createtextfile("path to new file",false,true)
ts.write chrw(65279)
ts.write strOld
ts.close

Or, you might be able to reduce that code to even simpler, by opening the text file as unicode in append mode. append the single character and exit.
Depending on what the downstream consumption of this file is, it may not matter if the BOM is at the beginning or anywhere else.
 

Users who are viewing this thread

Top Bottom