From a7648bb5a87889739a901e8b1c2e3b1538a31f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 25 Oct 2013 17:40:37 +0200 Subject: [PATCH] pcre: encoding needs to be set to utf8 --- basis/pcre/info/info-tests.factor | 2 +- basis/pcre/info/info.factor | 3 ++- basis/pcre/pcre.factor | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/basis/pcre/info/info-tests.factor b/basis/pcre/info/info-tests.factor index 361c907c95..be689fd988 100644 --- a/basis/pcre/info/info-tests.factor +++ b/basis/pcre/info/info-tests.factor @@ -1,4 +1,4 @@ -USING: accessors pcre pcre.info sequences tools.test ; +USING: accessors pcre pcre.info pcre.utils sequences tools.test ; [ { { 3 "day" } { 2 "month" } { 1 "year" } } ] [ diff --git a/basis/pcre/info/info.factor b/basis/pcre/info/info.factor index 0efee2b068..29a4c40436 100644 --- a/basis/pcre/info/info.factor +++ b/basis/pcre/info/info.factor @@ -2,6 +2,7 @@ USING: accessors alien alien.accessors alien.c-types alien.data alien.strings arrays + io.encodings.utf8 kernel math pcre.ffi pcre.utils @@ -22,7 +23,7 @@ IN: pcre.info PCRE_INFO_NAMEENTRYSIZE fullinfo ; : name-table-entry ( addr -- group-index group-name ) - [ 1 alien-unsigned-1 ] [ 2 + alien>native-string ] bi ; + [ 1 alien-unsigned-1 ] [ 2 + utf8 alien>string ] bi ; : options ( pcre -- opts ) f PCRE_INFO_OPTIONS fullinfo ; diff --git a/basis/pcre/pcre.factor b/basis/pcre/pcre.factor index c8d0769ac6..82f942c35c 100644 --- a/basis/pcre/pcre.factor +++ b/basis/pcre/pcre.factor @@ -72,7 +72,7 @@ TUPLE: matcher pcre extra subject ofs exec-opts match ; : parse-match ( subject nametable match-data -- match ) swapd first2 swap [ substring-list ] keep void* - [ alien>native-string ] { } map-as [ of swap 2array ] with map-index ; + [ utf8 alien>string ] { } map-as [ of swap 2array ] with map-index ; ! High-level : ( expr -- compiled-pcre )