Access - Exporting Data As Text File Using UTF-8 with BOM Encoding (1 Viewer)

EzGoingKev

Registered User.
Local time
Today, 07:10
Joined
Nov 8, 2019
Messages
178
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.
 

EzGoingKev

Registered User.
Local time
Today, 07:10
Joined
Nov 8, 2019
Messages
178
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.
 

isladogs

MVP / VIP
Local time
Today, 11:10
Joined
Jan 14, 2017
Messages
18,186
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
 

EzGoingKev

Registered User.
Local time
Today, 07:10
Joined
Nov 8, 2019
Messages
178
The export_specname tells it the first row are fields, tab separated, no text designator, etc. IDK how it would export right without that.
 

isladogs

MVP / VIP
Local time
Today, 11:10
Joined
Jan 14, 2017
Messages
18,186
OK but you didn't answer my question about the linked article which suggests BOM isn't needed with UTF-8
 

EzGoingKev

Registered User.
Local time
Today, 07:10
Joined
Nov 8, 2019
Messages
178
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."
 

isladogs

MVP / VIP
Local time
Today, 11:10
Joined
Jan 14, 2017
Messages
18,186
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

Top Bottom