View Single Post
Old 11-14-2019, 03:18 AM   #1
EbookMakers
Enthusiast
EbookMakers began at the beginning.
 
Posts: 26
Karma: 38
Join Date: Nov 2019
Location: Paris, France
Device: none
Editor plugin : problem with regex and special characters

Inside an editor plugin I'm running regex out of a Json file, like saved searches.
All works fine, except for high rank Unicode characters, for example I have :

Code:
{
      "case_sensitive": false, 
      "dot_all": false, 
      "find": "(‘)", 
      "mode": "regex", 
      "name": "LEFT SINGLE QUOTATION MARK REPLACE", 
      "replace": "'"
    },
Problem : this character is never found, even if I replace it with \u2018.
My Json file is Utf-8 encoded. I extract the pattern with :
Code:
pattern=unicode(searches["find"])
Even tried ur'pattern', nothing works.
I'm using the regex module and my compilation flags are : regex.VERSION1 | regex.WORD | regex.FULLCASE | regex.MULTILINE | regex.UNICODE

Same problem with all Unicode characters above \u2000.

Any idea to get it working ?
Thanks
EbookMakers is offline   Reply With Quote