[Issue 9629] toUpperInPlace doesn't work properly with unicode characters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 30 02:17:32 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9629


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com
           See Also|                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=10203


--- Comment #6 from monarchdodra at gmail.com 2013-05-30 02:17:28 PDT ---
(In reply to comment #0)
> wchar[] test = "hello þ world"w.dup;
> toUpperInPlace(test[6..7]);
> assert(test == "hello Þ world");
> 
> The unicode letter Thorn is not converted in place.

Apart from the fact that currently, toUpperInPlace is not actually InPlace,
which means this code does not work, and the whole r-value issue thingy, there
is something dreadfully wrong with this code:

UTF simply does not work this way, as the upper or lower of a string may not
have the same length as the original string.

Under this situation, doing what you are doing is aboslutly unsafe, and may end
up either not working (forced relocation), or filling the string with garbage.

--------
I was under the impression that this bug was mostly about the codegen issue, so
I did a new entry specifically for fixing the implementation of toUpperInPlace.

You can read in more details the issue there:
http://d.puremagic.com/issues/show_bug.cgi?id=10203

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list