aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-04-12 23:05:40 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-04-12 23:05:40 -0700
commitef60313a5db3adc5cd5cc5d15fa6008aea34ca4e (patch)
tree183af102095ec48551fadd0eb18e4ea2bcca190d /src
parentb25592c2386f415cbe34c1c08defce6f452e66ff (diff)
parent6426b02d3ddce39a2a3c2b34a0292b2d980e64ab (diff)
downloadmilf-rs-ef60313a5db3adc5cd5cc5d15fa6008aea34ca4e.tar.gz
milf-rs-ef60313a5db3adc5cd5cc5d15fa6008aea34ca4e.zip
Merge pull request #93 from trlim/master
Fix wrong handling of unicode escape code
Diffstat (limited to 'src')
-rw-r--r--src/parser.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 9eb506a..2a156e3 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -1,4 +1,3 @@
-use std::ascii::AsciiExt;
use std::char;
use std::collections::BTreeMap;
use std::error::Error;
@@ -490,7 +489,7 @@ impl<'a> Parser<'a> {
Some((pos, c @ 'U')) => {
let len = if c == 'u' {4} else {8};
let num = &me.input[pos+1..];
- let num = if num.len() >= len && num.is_ascii() {
+ let num = if num.char_indices().nth(len).map(|(i, _)| i).unwrap_or(0) == len {
&num[..len]
} else {
"invalid"