Hi
Code: Select all
Select Format
Case #PB_UTF16BE, #PB_UTF32, #PB_UTF32BE
End
EndSelect
That is not how to use Select, but in this case there is no role for select to play, that part of the code is redundant.
How to define "UTF-8 without BOM" in #PB_Ascii
Sorry but that question does not make sense. If you are reading a file that does not have a BOM, you might assume that it is an ASCII file, often it is, but there is no guarantee. Therefore, the file needs to be read and displayed so that the User can determine whether or not the text is good - that way, if the text is not good, the file can be re-read as UTF8 and again displayed and assessed. If there are a lot of files to be processed, you could of course ask the person that supplied them.
If you are writing the file as UTF8 but wish to omit the BOM, just do that, omit it!
Code: Select all
If CreateFile(#FileOut,MyFullPath)
WriteString(#FileOut, "I am an Arsenal Supporter", #PB_UTF8)
WriteString(#FileOut, "no need to groan", #PB_UTF8)
CloseFile(#FileOut)
Else
MessageRequester("Alert","File Create failed")
EndIf
How to find text if #PB_Ascii as Win-1251 in Linux
From Wikipedia:
Windows-1251
Windows-1251 is an 8-bit character encoding, designed to cover languages that use the Cyrillic script such as Russian, Bulgarian, Serbian Cyrillic and other languages. It is the most widely used encoding for the Bulgarian, Serbian and Macedonian languages.[citation needed] As of December 2020, 0.9% of all (and 0.6% of top-1000[1]) websites use Windows-1251.[2][3] However, it is used by 9.9% of Russian (.ru) websites....
So Win-1251 is effectively a special extension of standard ASCII that PB is perhaps unlikely to be able to process correctly without some form of translation. There are a few discussions in the forum if you search for "Win 1251". For example:
viewtopic.php?f=13&t=35027
How to find text in binary files
To find text in a binary file, you need to know the format of the text before it was saved to binary.
Some methods here:
viewtopic.php?f=13&t=42561