Page 5 of 11

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Sat Nov 08, 2014 7:51 am
by Ivan Denisov
We need to vote here:
- do we need to make validation in Utf8ToString according UTF-8 standard and can mark it for public usage
- we do not need to make validation in Utf8ToString and will use this procedure internally or mark it as unsafe in documentation

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Sat Nov 08, 2014 8:10 am
by Ivan Denisov
Josef Templ wrote:Ivan, please keep it simple. You are inventing problems that don't exist.
Our Utf-8 converters convert any 'Valid' Component-Pascal string into Utf-8 AND back.
In Component Pascal a string is valid if it is 0X terminated.
Since Component-Pascal does not restrict the character codes, why should the Utf-8 converter?
With your approach you end up for some strings in a legal StringToUtf8 conversion that
cannot be converted back by Utf8ToString. This is really strange
and the alternative is so obvious and so simple.
It is possible case, that we will use such converter internally in Kernel without validity checking for better speed. But in Strings will provide the full Alexander version of converter. However I sure that difference in speed in total will be very small.

Also Josef, you said "The hackers are very smart." 12 Aug 2014.
Please, read this: http://www.unicode.org/reports/tr36/#UTF-8_Exploit

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Sat Nov 08, 2014 11:14 am
by Ivan Denisov
Zinn and Josef, please look at the table 3-7 here:
http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf
wellformedutf8.png
wellformedutf8.png (80 KiB) Viewed 22854 times

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Sat Nov 08, 2014 10:12 pm
by DGDanforth
Ivan,
It appears that a simple case statement would implement that table, right?

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Sun Nov 09, 2014 2:30 am
by Ivan Denisov
DGDanforth wrote:Ivan,
It appears that a simple case statement would implement that table, right?
Case statements with simple "state machine":
http://forum.oberoncore.ru/viewtopic.ph ... 92b#p89571

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Sun Nov 09, 2014 10:00 pm
by Josef Templ
> - Format errors inside identifier does not occur

If you decode a string that has been written by BB 1.6 into a symbol or object file
you may get a format error. Such a situation is possible and must be covered by the decoder.
Helmut, your approach is too simple; Ivan's approach is too complex.
My approach is exactly in between.
That approach detects format errors but does not care about the contents,
i.e. it treats all 16-bit characters codes as legal in the same way as Component Pascal does it.
It is so obvious that it is hard to believe for me that there is any discussion about it.

- Josef

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Wed Nov 12, 2014 12:49 pm
by Ivan Denisov
I incorporate last Helmut bugfix into branch #19.

This also led to extinction of the building pipeline bug about appendingProperties in System/Strings.odc and in About dialog.

You can test new version here:
blackbox-1.7-a1.025.zip
blackbox-1.7-a1.025-setup.exe

Also I removed forced SHORTCHAR to CHAR converstion in a case of return 2 ("decode incomplete or error").

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Fri Nov 14, 2014 5:05 pm
by Ivan Denisov
Josef, Helmut, Doug and others, can we make the vote now?

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Fri Nov 14, 2014 5:09 pm
by Ivan Denisov
Josef Templ wrote:> - Format errors inside identifier does not occur

If you decode a string that has been written by BB 1.6 into a symbol or object file
you may get a format error. Such a situation is possible and must be covered by the decoder.
Helmut, your approach is too simple; Ivan's approach is too complex.
My approach is exactly in between.
That approach detects format errors but does not care about the contents,
i.e. it treats all 16-bit characters codes as legal in the same way as Component Pascal does it.
It is so obvious that it is hard to believe for me that there is any discussion about it.

- Josef
Josef, if you will use it internally there will be no problem. But you want to transfer this to Strings and people will use it for many purposes.
Again, we should led the Unicode standard. I have found the table with well formed UTF-8. Alexander made some effort. I do not understand, why you do not like the single working algorithm?

Re: Issue #19: Unicode for Component Pascal identifiers

Posted: Fri Nov 14, 2014 7:44 pm
by DGDanforth
Ivan Denisov wrote:Josef, Helmut, Doug and others, can we make the vote now?
I'd like to here more from Josef on the issue before we vote.