[Issue 17708] Escape control characters in std.conv.to error messages

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 17 18:50:54 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17708

Jon Degenhardt <jrdemail2000-dlang at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrdemail2000-dlang at yahoo.co
                   |                            |m

--- Comment #1 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
Encountered this case in my tools
(https://github.com/eBay/tsv-utils-dlang/issues/96). A user was processing a
DOS file (with `\r\n` line endings) on a Unix box, byLine left the extraneous
`\r` at the end of the line. My tool tried to convert to double, and output the
error text when this failed due to the `\r`. The formatting of the output is
quite confusing, as `\r` actually repositions to the start of the line,
effectively deleting the initial part of the output line. The result:

  ' when converting from type const(char)[] to type doubleUnexpected '

For my tools I'll add explicit detection of DOS line endings on Unix boxes,
it's just too common when getting data files from a variety of sources.
However, it'd be helpful to update error message generation to handle `\r` and
other non-printing characters.

--


More information about the Digitalmars-d-bugs mailing list