From f8ba2cb43bdcf3a1466a13b2c32b08f6a37dd7fb Mon Sep 17 00:00:00 2001 From: Greg Chapple Date: Wed, 7 Jan 2015 09:43:19 +0000 Subject: [PATCH] Remove char::from_u32 call, added note about unicode --- src/iota/buffer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/iota/buffer.rs b/src/iota/buffer.rs index 21e890e..3661d6a 100644 --- a/src/iota/buffer.rs +++ b/src/iota/buffer.rs @@ -1,6 +1,6 @@ //FIXME: Check unicode support // stdlib dependencies -use std::{ cmp, char }; +use std::cmp; use std::collections::HashMap; use std::io::{File, Reader, BufferedReader}; @@ -258,7 +258,8 @@ impl WordEdgeMatch { /// If c1 -> c2 is the start of a word. /// If end of word matching is wanted then pass the chars in reversed. fn is_word_edge(&self, c1: &u8, c2: &u8) -> bool { - match (self, char::from_u32(*c1 as u32).unwrap(), char::from_u32(*c2 as u32).unwrap()) { + // FIXME: unicode support - issue #69 + match (self, *c1 as char, *c2 as char) { (_, '\n', '\n') => true, // Blank lines are always counted as a word (&WordEdgeMatch::Whitespace, c1, c2) => c1.is_whitespace() && !c2.is_whitespace(), (&WordEdgeMatch::Alphabet, c1, c2) if c1.is_whitespace() => !c2.is_whitespace(),