diff --git a/base/show.jl b/base/show.jl index fefb5d2650dd1..164031b7a5884 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1031,7 +1031,7 @@ function show_unquoted_quote_expr(io::IO, @nospecialize(value), indent::Int, pre print(io, ":") print(io, value) else - print(io, "Symbol(\"", escape_string(s), "\")") + print(io, "Symbol(", repr(s), ")") end else if isa(value,Expr) && value.head === :block diff --git a/test/show.jl b/test/show.jl index a480812f4618e..b48b33a43d560 100644 --- a/test/show.jl +++ b/test/show.jl @@ -1416,3 +1416,6 @@ end replstrcolor(x) = sprint((io, x) -> show(IOContext(io, :limit => true, :color => true), MIME("text/plain"), x), x) @test occursin("\e[", replstrcolor(`curl abc`)) + +# issue #30303 +@test repr(Symbol("a\$")) == "Symbol(\"a\\\$\")"