diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-05-17 11:50:20 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-05-17 11:50:20 +0000 |
commit | c301d6bfc6c1471a4225e7e6e993b6e160f76c1b (patch) | |
tree | 0aa4dd6700e45eb7dc861fe73bf61649fc3eee5c /chars.c | |
parent | 8cd2f76125361d3c04dd2730e7748c925a33d2a2 (diff) | |
download | mandoc-c301d6bfc6c1471a4225e7e6e993b6e160f76c1b.tar.gz |
Flip on unicode output (via \[uNNNN]) in -T[x]html. Here we go!
Diffstat (limited to 'chars.c')
-rw-r--r-- | chars.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -138,7 +138,7 @@ mchars_res2cp(struct mchars *arg, const char *p, size_t sz) } /* - * Numbered character to literal character. + * Numbered character string to ASCII codepoint. * This can only be a printable character (i.e., alnum, punct, space) so * prevent the character from ruining our state (backspace, newline, and * so on). @@ -151,10 +151,24 @@ mchars_num2char(const char *p, size_t sz) if ((i = mandoc_strntou(p, sz, 10)) < 0) return('\0'); - return(isprint(i) ? i : '\0'); } +/* + * Hex character string to Unicode codepoint. + * If the character is illegal, returns '\0'. + */ +int +mchars_num2uc(const char *p, size_t sz) +{ + int i; + + if ((i = mandoc_strntou(p, sz, 16)) < 0) + return('\0'); + /* FIXME: make sure we're not in a bogus range. */ + return(i > 0x80 && i <= 0x10FFFF ? i : '\0'); +} + /* * Special character to string array. */ |