[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Challenges of adding octal and hexadecimal escape sequences in strin
From: |
Mohammad-Reza Nabipoor |
Subject: |
Re: Challenges of adding octal and hexadecimal escape sequences in strings |
Date: |
Mon, 2 Nov 2020 01:47:49 +0330 |
Hi, Dan.
On Sun, Nov 01, 2020 at 09:43:51PM +0100, Dan Čermák wrote:
> Hi Mohammad,
>
> I think this is a good idea, because there can be situations where you
> want to have strings including a NULL (C++ explicitly supports this in
> std::string for instance).
>
> Also, something comparable would be probably required anyway for proper
> UTF8 support, where the string's length is not equal to the number of
> bytes (minus 1).
>
> So starting this now sounds like a good idea.
>
Thanks for your support.
But as Jose shed some light on the problem, the best approach is to keep the
Poke strings as "NULL-terminated array of bytes" entities.
If the user needs to deal with some string-like entities that can contain NULL
characters, he/she can use `uint<8>[string_len]` instead.
And regarding UTF-8 support at language-level, IMHO the best approach is to
"ignore" that :) (Ostrich algorithm!).
Because, e.g., Go programming language went down that road and there are too
many dragons there :D (https://blog.golang.org/strings)
I also worked on `utf8.pk` pickle to deal with UTF-8 data, but due to a bug
in poke, it's currently unusable (making an array inside method leads to
abortion: Bug 26695).
And again, thanks for your participation in this thread :+1:
Regards,
Mohammad-Reza