Thread overview
[Issue 755] New: std.utf.decode() throws exception with typo
Dec 27, 2006
d-bugmail
[Issue 755] std.utf.decode() throws exception with unclear error message
Dec 28, 2006
d-bugmail
Dec 28, 2006
d-bugmail
December 27, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=755

           Summary: std.utf.decode() throws exception with typo
           Product: D
           Version: 0.178
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: luismarques@gmail.com


On line 345 of utf.d (std.utf) we can find:

throw new UtfException("4invalid UTF-8 sequence", i);

The "4" seems to be a typo (which makes for ugly error messages:)


-- 

December 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=755


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.utf.decode() throws     |std.utf.decode() throws
                   |exception with typo         |exception with unclear error
                   |                            |message




------- Comment #1 from deewiant@gmail.com  2006-12-28 06:42 -------
It's not a typo: within std.utf you'll find "Ninvalid UTF-8 sequence", where N ranges from 1 to 5. 4 is just the most common, because it's in the decode() method which is used by std.format.doFormat, which, in turn, is used by the writef family.

I agree, however, that it makes for ugly error messages, and it does appear a lot like a typo, so I'll leave the bug open - just renamed.


-- 

December 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=755





------- Comment #2 from luismarques@gmail.com  2006-12-28 07:51 -------
Ok, changing the message seems a fine choice to me.
Perhaps "invalid UTF-8 sequence at byte X"?


-- 

October 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=755


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=755


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-09-13 20:32:44 PDT ---
I replaced the culprit with:

    throw new UtfException(text("dchar decode(in char[], ref size_t): "
                    "Invalid UTF-8 sequence ", cast(const ubyte[]) s,
                    " around index ", i));

http://www.dsource.org/projects/phobos/changeset/1999

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