URL:
<http://savannah.gnu.org/bugs/?31650>
Summary: ice-9 regexp doesn't work with multibyte chars
Project: Guile
Submitted by: wingo
Submitted on: Sun 14 Nov 2010 10:59:13 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Steps to reproduce:
> (setlocale LC_ALL)
> (match:substring (string-match ".*" "calçot") 0)
Expected results:
"calçot"
Actual results:
ERROR: In procedure substring:
ERROR: Value out of range 0 to 6: 7
I think what is happening is that as per
http://www.gnu.org/software/libc/manual/html_node/Regexp-Subexpressions.html#Regexp-Subexpressions,
the regmatch_t structure gives us *byte offsets* at which the string matched,
but Guile's match structures need *char offsets*. So we need to be able to do
a reverse mapping between byte index of a string as encoded in the current
locale to the character index.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31650>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/