www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8800] New: Invalid UTF-8 sequences allowed in strings with 'c' postfix.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8800

           Summary: Invalid UTF-8 sequences allowed in strings with 'c'
                    postfix.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: aziz.koeksal gmail.com



PDT ---
Consider this code:

auto s1 = "\x80";  // No error.
auto s2 = "\x80"c; // No error.
auto s3 = "\x80"w; // Error: invalid UTF-8 sequence
auto s4 = "\x80"d; // Error: invalid UTF-8 sequence

When the user explicitly appends the c-postfix, I think for consistency's sake,
the string should be validated and invalid UTF-8 sequences should be rejected.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8800


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WONTFIX



06:08:41 PDT ---
I think this could become very annoying, as strings are often invalid UTF-8
sequences while they are being constructed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8800


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8800




PDT ---
I'm not sure how it would, because I'm only talking about string literals.

So code like this would still work, of course:

auto s = "valid utf-8"c;
s ~= "invalid utf-8: \x80";

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