aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--adapter/protocol/man.nim3
-rw-r--r--res/genidna.nim5
3 files changed, 5 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0492253d..7a129061 100644
--- a/Makefile
+++ b/Makefile
@@ -110,7 +110,7 @@ $(OUTDIR_BIN)/mancha: adapter/tools/mancha.nim
unicode_version = 16.0.0
.PHONY: unicode_gen
-unicode_gen: $(OBJDIR)/genidna $(OBJDIR)/gencharwidth
+unicode_gen:
@printf 'Download EastAsianWidth.txt and IdnaMappingTable.txt from www.unicode.org? (y/n) '
@read res; if test "$$res" = "y"; then \
cha -d 'https://www.unicode.org/Public/idna/$(unicode_version)/IdnaMappingTable.txt' >res/map/IdnaMappingTable.txt; \
diff --git a/adapter/protocol/man.nim b/adapter/protocol/man.nim
index a8c4ae34..d1566b87 100644
--- a/adapter/protocol/man.nim
+++ b/adapter/protocol/man.nim
@@ -1,7 +1,6 @@
import std/os
import std/posix
import std/strutils
-from std/unicode import runeLenAt
import monoucha/jsregex
import monoucha/libregexp
@@ -51,7 +50,7 @@ func processBackspace(line: string): string =
bspace = true
inc i
continue
- let n = line.runeLenAt(i)
+ let n = line.pointLenAt(i)
if thiscs.len == 0:
thiscs = i ..< i + n
i += n
diff --git a/res/genidna.nim b/res/genidna.nim
index 4ae9d34c..911c67ad 100644
--- a/res/genidna.nim
+++ b/res/genidna.nim
@@ -3,7 +3,8 @@ import std/sets
import std/streams
import std/strutils
import std/tables
-import std/unicode
+
+import utils/twtstr
type
LowMap = seq[tuple[ucs: uint16, s: string]]
@@ -116,7 +117,7 @@ proc loadIdnaData() =
let codepoints = thirdcol
var str = ""
for code in codepoints:
- str &= Rune(parseHexInt(code))
+ str &= uint32(parseHexInt(code)).toUTF8()
add(firstcol, str, add_map)
of "valid":