zsh-workers
 help / color / mirror / code / Atom feed
From: 정누리 <jnooree@gmail.com>
To: zsh-workers@zsh.org
Subject: zsh/pcre has errors with unicode bytes
Date: Mon, 13 Jul 2020 11:53:19 +0900	[thread overview]
Message-ID: <DF33AF21-A6D3-46E6-831D-1EC15049E975@gmail.com> (raw)

Hi,

Looks like an error related to unicode bytes exists in current release (5.8) of the zsh/pcre.
When the locale is set to 'C' and trying to process a unicode string byte-by-byte, e.g.,

$ LC_ALL='C'
$ str='Hi😊'
$ for (( i = 1; i <= ${#str}; ++i )); do                     
      byte="$str[i]"
      ord=$(( [##16] #byte ))                           
      echo $ord
  done
>> 48
69
F0
9F
98
8A
$ for (( i = 1; i <= ${#str}; ++i )); do                     
      byte="$str[i]"                  
      [[ $byte -regex-match [a-zA-Z0-9] ]] && echo $byte || echo 'no match'
  done
>> H
   i
   no match
   no match
   no match
   no match
$ for (( i = 1; i <= ${#str}; ++i )); do                     
      byte="$str[i]"                  
      [[ $byte -pcre-match [a-zA-Z0-9] ]] && echo $byte || echo 'no match'
  done
>> H
   i
   zsh: pcre_exec() error [-10]
   no match
   zsh: pcre_exec() error [-10]
   no match
   zsh: pcre_exec() error [-10]
   no match
   zsh: pcre_exec() error [-10]
   no match

Thanks for reading.

             reply	other threads:[~2020-07-13  2:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13  2:53 정누리 [this message]
2020-07-13 14:02 ` Daniel Shahaf
2020-07-15  7:43 ` Jun T

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

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

  git send-email \
    --in-reply-to=DF33AF21-A6D3-46E6-831D-1EC15049E975@gmail.com \
    --to=jnooree@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).