Skip to content

Showing string with escaped characters (invalid or special) prints too wide #58593

@Keno

Description

@Keno
julia> s = "\xc0\xa0\xe2\x88\xe2|"
Error showing value of type String:

SYSTEM (REPL): showing an error caused an error
ERROR: 1-element ExceptionStack:
Base.InvalidCharError{Char}('\xc0\xa0')
Stacktrace:
  [1] throw_invalid_char(c::Char)
    @ Base ./char.jl:95
  [2] UInt32
    @ ./char.jl:142 [inlined]
  [3] convert
    @ ./char.jl:194 [inlined]
  [4] cconvert
    @ ./essentials.jl:720 [inlined]
  [5] textwidth
    @ ./strings/unicode.jl:276 [inlined]

It's particularly embarrassing, because this is the example we have in the docs to show that we handle this case gracefullly (but we didn't doctest it).

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions