diff --git a/src/error.rs b/src/error.rs index ae6a397..c0ec7c7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -51,7 +51,7 @@ quick_error! { display("class {} is invalid", code) } /// Invalid characters encountered while reading label - LabelIsNotAscii { + LabelIsNotUtf8 { description("invalid characters encountered while reading label") } /// Invalid characters encountered while reading TXT diff --git a/src/name.rs b/src/name.rs index 054bba6..83b3c2d 100644 --- a/src/name.rs +++ b/src/name.rs @@ -74,8 +74,8 @@ impl<'a> Name<'a> { if parse_data.len() < end { return Err(Error::UnexpectedEOF); } - if !parse_data[pos+1..end].is_ascii() { - return Err(Error::LabelIsNotAscii); + if from_utf8(&parse_data[pos+1..end]).is_err() { + return Err(Error::LabelIsNotUtf8); } pos = end; if parse_data.len() <= pos {