From 84a2490200458f5892e156a95dc2f51b9767b128 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sat, 4 May 2013 13:52:58 +0800 Subject: [PATCH] workaround of soft hyphen --- src/util/css_const.h.in | 2 +- src/util/unicode.cc | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/util/css_const.h.in b/src/util/css_const.h.in index a1803c7..1e9f1aa 100644 --- a/src/util/css_const.h.in +++ b/src/util/css_const.h.in @@ -1,4 +1,4 @@ -/* vim: filetype=cpp : */ +/* vim: set filetype=cpp : */ /* * css_const.h * diff --git a/src/util/unicode.cc b/src/util/unicode.cc index 7e047b6..e7c96ee 100644 --- a/src/util/unicode.cc +++ b/src/util/unicode.cc @@ -17,7 +17,12 @@ using std::cerr; using std::endl; using std::ostream; -/* Test legal for HTML */ +/* + * Test legal for HTML + * + * A legal unicode character should be accepted by browsers, and displayed correctly. + * This function is not complete, just to be improved. + */ bool isLegalUnicode(Unicode u) { /* @@ -47,6 +52,13 @@ bool isLegalUnicode(Unicode u) if((u >= 127) && (u <= 160)) return false; + /* + * 173, or 0xad, is the soft hyphen + * which can be ignored by the browser in the middle of a line + */ + if(u == 173) + return false; + if((u >= 0xd800) && (u <= 0xdfff)) return false;