A serious problem when the source code is being saved in UTF-8 file format. See the bug description in the following code for more details.
Best regards
StarBootics
Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; File Name : Save text file bug.pb
; File version: 1.0.0
; Programming : Bug Demonstrator
; Programmed by : StarBootics
; Date : November 17th, 2022
; Last Update : November 17th, 2022
; PureBasic code : V6.00 LTS
; Platform : Debian GNU/Linux 11 (bullseye) x86-64
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Bug description
;
; When you run this code when it's being saved in Plain text
; file format, the created file size are :
;
; Text ascii file size : 32
; Text UTF-8 file size : 36
; Text UTF-16 file size : 68
;
; When we open the files with GEdit the file content is
; what we expect to have.
;
; Ce texte est en théorie en Ascii
; Ce texte est en théorie en UTF-8
; Ce texte est en théorie en UTF-16
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;
; When you run this code when it's being saved in UTF-8
; file format, the created file size are :
;
; Text ascii file size : 33
; Text UTF-8 file size : 38
; Text UTF-16 file size : 70
;
; Furthermore when we open the text files with GEdit we have
; an issue with the file content, it look like that :
;
; Ce texte est en théorie en Ascii
; Ce texte est en théorie en UTF-8
; Ce texte est en théorie en UTF-16
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If CreateFile(0, "Text ascii")
WriteStringFormat(0, #PB_Ascii)
WriteString(0, "Ce texte est en théorie en Ascii", #PB_Ascii)
CloseFile(0)
EndIf
If CreateFile(0, "Text UTF-8")
WriteStringFormat(0, #PB_UTF8)
WriteString(0, "Ce texte est en théorie en UTF-8", #PB_UTF8)
CloseFile(0)
EndIf
If CreateFile(0, "Text UTF-16")
WriteStringFormat(0, #PB_Unicode)
WriteString(0, "Ce texte est en théorie en UTF-16", #PB_Unicode)
CloseFile(0)
EndIf
Debug "Text ascii file size : " + Str(FileSize("Text ascii"))
Debug "Text UTF-8 file size : " + Str(FileSize("Text UTF-8"))
Debug "Text UTF-16 file size : " + Str(FileSize("Text UTF-16"))
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<