Access - Exporting Data As Text File Using UTF-8 with BOM Encoding

EzGoingKev

Registered User.
Local time
Today, 06:52
Joined
Nov 8, 2019
Messages
188
Good afternoon.

I have to build load sheets for a web based third party application my company uses.

- I build the data in Access.
- I export the data out to a text file using DoCmd.TransferText.
- Once the text files are saved I need to manually open each one. Once open I use File -> Save As.
- When the Save As dialog box opens I have to change the encoding to UTF-8 with BOM.
- Once all the text files have been saved using that encoding I put them in a ZIP folder.
- I upload the ZIP folder into the web based app.

I may be wrong but I do not believe the steps above give me a "real" UTF-8 with BOM encoded file.

Is there a way I can incorporate the part above in bold into my export code to give me a file that has the UTF-8 with BOM encoding?

And FYI - Before anyone tells me this a bad way to do it and that I should be doing it this way instead - I have no control over this at all. This is the way I was told to do it. I do know if you do not open and re-save it with the UTF-8 with BOM selected the app kicks it for invalid format.
 
I have tried using the 65001 at the end when exporting using the following code:
Code:
DoCmd.TransferText acExportDelim, "export_specname", TableName, "C:\Users\Name\Desktop\FileName.txt", True,, 65001

I also tried:
Code:
DoCmd.TransferText acExportDelim, "export_specname", TableName, "C:\Users\Name\Desktop\FileName.txt", True, "", 65001

When I open the file it lists the encoding as UTF-8, not UTF-8 with BOM.
 
Yes I know. There is no code page option for UTF-8 with BOM.
Have you tried omitting "export_specname"?

Did you read the first link in my last post? See the sidebar text
 
The export_specname tells it the first row are fields, tab separated, no text designator, etc. IDK how it would export right without that.
 
OK but you didn't answer my question about the linked article which suggests BOM isn't needed with UTF-8
 
OK but you didn't answer my question about the linked article which suggests BOM isn't needed with UTF-8
Did you read this part of my OP -

"And FYI - Before anyone tells me this a bad way to do it and that I should be doing it this way instead - I have no control over this at all. This is the way I was told to do it. I do know if you do not open and re-save it with the UTF-8 with BOM selected the app kicks it for invalid format."
 
Yes I did...which is why I quoted the article.
I'll drop out now as we're going around in circles.

Good luck finding a solution
 

Users who are viewing this thread

Back
Top Bottom