From 88213ce95acf88a82cd446500dc7de730f4dd669 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 15 Jan 2025 16:00:58 +0100 Subject: Move check for ASCII-only strings into the parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/parser.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/xixanta/src/parser.rs') diff --git a/lib/xixanta/src/parser.rs b/lib/xixanta/src/parser.rs index d42ff12..524f7c2 100644 --- a/lib/xixanta/src/parser.rs +++ b/lib/xixanta/src/parser.rs @@ -902,6 +902,10 @@ impl Parser { // character (unless it was escaped through '\'). let mut prev = '"'; for ch in line.get(self.offset..).unwrap_or("").chars() { + if !ch.is_ascii() { + return Err(self.parser_error("using non-ASCII characters in a string")); + } + if ch == '"' && prev != '\\' { self.next(); -- cgit v1.2.3