diff --git a/base/c.jl b/base/c.jl index b79c6a4112387..87238f4b6580c 100644 --- a/base/c.jl +++ b/base/c.jl @@ -67,7 +67,7 @@ containsnul(p::Ptr, len) = C_NULL != ccall(:memchr, Ptr{Cchar}, (Ptr{Cchar}, Cin function unsafe_convert(::Type{Cstring}, s::ByteString) p = unsafe_convert(Ptr{Cchar}, s) if containsnul(p, sizeof(s)) - throw(ArgumentError("embedded NUL chars are not allowed in C strings")) + throw(ArgumentError("embedded NUL chars are not allowed in C strings: $(repr(s))")) end return Cstring(p) end diff --git a/base/string.jl b/base/string.jl index ebe3c8db8fe1e..baad4586acdd8 100644 --- a/base/string.jl +++ b/base/string.jl @@ -1722,7 +1722,7 @@ wstring(s::Cwstring) = wstring(box(Ptr{Cwchar_t}, unbox(Cwstring,s))) # to have WString function unsafe_convert(::Type{Cwstring}, s::WString) if containsnul(s) - throw(ArgumentError("embedded NUL chars are not allowed in C strings")) + throw(ArgumentError("embedded NUL chars are not allowed in C strings: $(repr(s))")) end return Cwstring(unsafe_convert(Ptr{Cwchar_t}, s)) end