[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #31650] ice-9 regexp doesn't work with multibyte chars
From: |
Andy Wingo |
Subject: |
[bug #31650] ice-9 regexp doesn't work with multibyte chars |
Date: |
Sun, 14 Nov 2010 10:59:14 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Epiphany/2.30.2 |
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/
- [bug #31650] ice-9 regexp doesn't work with multibyte chars,
Andy Wingo <=