Default for read/write string operations for unicode program

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Default for read/write string operations for unicode program

Post by Demivec »

#PB_Ascii : all read/write string operation will use ascii if not specified otherwise (default for ASCII executable).
#PB_UTF8 : all read/write string operation will use UTF-8 if not specified otherwise (default for Unicode executable).
#PB_Unicode: all read/write string operation will use Unicode if not specified otherwise.
Currently (as of v5.41b2) the default for OpenFile(), CreateFile(), and ReadFile() in a Unicode executible is to use #PB_UTF8 for all read/write string operations unless otherwise specified.

I request that #PB_Unicode be used instead.
Last edited by Demivec on Thu Dec 10, 2015 7:57 pm, edited 1 time in total.
sys64802
Enthusiast
Enthusiast
Posts: 105
Joined: Sat Sep 12, 2015 6:55 pm

Re: Default for read/write string operations for unicode pro

Post by sys64802 »

Why you would like this to be changed ?

And for what reason UTF8 was chosen instead ?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Default for read/write string operations for unicode pro

Post by Demivec »

sys64802 wrote:Why you would like this to be changed ?

And for what reason UTF8 was chosen instead ?
IMHO it is more consistent for #PB_Unicode to be the standard for a unicode executible. (See your second question :) )
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Default for read/write string operations for unicode pro

Post by ts-soft »

Most written Text a in UTF-8, this is the standard for writing Text, Config Files, HTML and so on. The default of UTF-8 should be okay.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: Default for read/write string operations for unicode pro

Post by kenmo »

Nooooooo, -1 vote from me :)

I am glad the team is making UTF-8 the default for more and more functions. I consider it the best encoding for any text that goes "outside the program" (file I/O, networking, communicating with other executables, ...).

UTF-8 has lots of benefits:
- handles ALL Unicode characters (up to 4-byte characters)
- no endianness confusion (and no BOM needed)
- backwards compatible with ASCII text
- NULL bytes never appear, so they can be used as terminators just like in ASCII
- standard encoding for XML, JSON (HTML?)
- Western languages (including most programming and markup languages) take up minimal space (no NULLs every other byte)
- many more, see http://utf8everywhere.org/ and https://en.wikipedia.org/wiki/UTF-8

The choice for PureBasic Unicode to use UCS-2 encoded strings in memory is OK (but has some critics around here), but I don't know hardly any programs that use UCS-2 for files.
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Default for read/write string operations for unicode pro

Post by Demivec »

Based on each of the replies I have concluded that I was being shortsighted. I withdraw my request.
Post Reply