Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ end
readuntil_string(s::IO, delim::UInt8, keep::Bool) = String(readuntil(s, delim, keep=keep))::String

function readuntil(s::IO, delim::AbstractChar; keep::Bool=false)
if delim ≤ '\x7f'
if isascii(delim)
return readuntil_string(s, delim % UInt8, keep)
end
out = IOBuffer()
Expand Down Expand Up @@ -925,7 +925,7 @@ function readuntil(io::IO, target::AbstractString; keep::Bool=false)
x = Iterators.peel(target)
isnothing(x) && return ""
c, rest = x
if isempty(rest) && c <= '\x7f'
if isempty(rest) && isascii(c)
return readuntil_string(io, c % UInt8, keep)
end
# convert String to a utf8-byte-iterator
Expand Down
2 changes: 1 addition & 1 deletion base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ julia> replace("abcdeγfgh", !isascii=>' ') # replace non-ASCII chars with space
"abcde fgh"
```
"""
isascii(c::Char) = bswap(reinterpret(UInt32, c)) < 0x80
isascii(c::Char) = c <= '\x7f'
isascii(s::AbstractString) = all(isascii, s)
isascii(c::AbstractChar) = UInt32(c) < 0x80

Expand Down