unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <INVALID.NOREPLY@gnu.org>
To: Andy Wingo <wingo@pobox.com>, bug-guile@gnu.org
Subject: [bug #31650] ice-9 regexp doesn't work with multibyte chars
Date: Sun, 14 Nov 2010 10:59:14 +0000	[thread overview]
Message-ID: <20101114-105913.sv20118.39975@savannah.gnu.org> (raw)
In-Reply-To: 


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/




             reply	other threads:[~2010-11-14 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 10:59 Andy Wingo [this message]
2010-11-23 21:36 ` [bug #31650] ice-9 regexp doesn't work with multibyte chars Andy Wingo
2011-01-21  7:35 ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101114-105913.sv20118.39975@savannah.gnu.org \
    --to=invalid.noreply@gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).