C2 forum

General Category => Ideas => Topic started by: acbaile on September 22, 2018, 05:00:01 AM

Title: deleted
Post by: acbaile on September 22, 2018, 05:00:01 AM
deleted
Title: Re: Support of Unicode ?
Post by: bas on September 24, 2018, 12:34:08 PM
Support of Unicode is simply not in yet. Ideally it would unify all the different approaches used in C code.
But the discussion on what to include (eg. only UTF-8, etc) is a tricky one that has no neat solution i fear.
UTF is not in yet, because C2's goal domain is embedded drivers/kernels/operating systems, etc. There UTF
is not really important as in a generic systems language.

But I haven't really looked into a proper UTF solution yet. On the web, UTF-8 is definately dominating.
Title: Re: Support of Unicode ?
Post by: bas on September 28, 2018, 03:48:59 PM
Lol.. The basic scenario of the actual encoding is indeed a standard. But how to integrate in a language is another thing.
A programming language is a bag of choices; make it easy for some, but harder for other developers; force something on
everyone or allow multiple solutions; there's never an actual best solution for everyone. With UTF (and other encodings)
the most important thing I think is how it interacts with the common C string (ie const char*). So how do you go from one to
the other and so on. Also how do you define string constants that are UTF-8? maybe like u"My UTF-8 String" (for example)
Title: Re: Support of Unicode ?
Post by: lerno on October 17, 2018, 11:26:54 PM
Most languages go for UTF8. Everything else is standardizing on UTF8 as well. Since (forward) string search is easy in UTF8, you get like 95% of everything you want with UTF8.

For any text handling that needs more optimized handling, simply offer a conversion to other formats as a byte array. C libraries can handle everything else.
Title: Re: Support of Unicode ?
Post by: lerno on October 29, 2018, 08:32:42 AM
Personally, I think we should have first class strings in the language, and then C style strings are created using c”Hello World”.
Title: Re: Support of Unicode ?
Post by: lerno on November 18, 2018, 04:14:46 PM
Swift recently switched to an internal representation of UTF-8 and said it worked out to being faster than alternatives even for languages where UTF-16/32 is considered "better".

https://forums.swift.org/t/string-s-abi-and-utf-8/17676
Title: Re: Support of Unicode ?
Post by: bas on November 30, 2018, 01:42:52 PM
In all my years of programming, I've only had to do I18n twice. Both were C++ projects. In C never. In C a basic string is just a char* with 8-bit characters. That
works for 99.9% of the cases. What would be nice if we could add special Strings as an optional feature. If not used, no overhead etc.
Title: Re: Support of Unicode ?
Post by: bas on December 02, 2018, 12:15:51 PM
I'm not agaist Unicode in C2, but i just want in there as an optional part that you can use or not. So a basic string will Not be Unicode.