[Solved] Create text file

Just starting out? Need help? Post your questions and find answers here.
ZX80
Enthusiast
Enthusiast
Posts: 330
Joined: Mon Dec 12, 2016 1:37 pm

[Solved] Create text file

Post by ZX80 »

Hi to all.

Sorry for my another stupid question, but how to create a utf-16 encoded file (little endian) with BOM?
Help tells me to use the #PB_Unicode constant, but the result is completely different. Or should I write the first three bytes myself (FF FE 57) ?

Code: Select all

CreateFile(0, "test.txt", #PB_Unicode)
It doesn't work that way, but why?

Thanks in advance.
Last edited by ZX80 on Thu Jul 29, 2021 1:03 pm, edited 1 time in total.
firace
Addict
Addict
Posts: 899
Joined: Wed Nov 09, 2011 8:58 am

Re: Create text file

Post by firace »

This should help :)

WriteStringFormat(#File, #PB_Unicode)
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Create text file

Post by Kiffi »

Take a look at WriteStringFormat().
Hygge
ZX80
Enthusiast
Enthusiast
Posts: 330
Joined: Mon Dec 12, 2016 1:37 pm

Re: Create text file

Post by ZX80 »

firace, Kiffi, thank you so much!

It works now.
Post Reply