non-ascii-characters

Python regex and accented Expression [duplicate]

匆匆过客 提交于 2020-01-07 03:47:04
问题 This question already has answers here : How to prevent str to encode unicode characters as hex codes? (2 answers) Closed 3 years ago . I have problem with my Python RegEx treatment bloc when it deals with accented Expression. When I run my code: import re title = ur"Titre : c'est pas gréable à Infos:" print title m = re.findall(":(.+?) Infos",title , re.UNICODE) print unicode((m)) i have this result: Titre : c'est pas gréable à Infos: [u" c'est pas gr\xe9able \xe0"] I need to be able to keep

HTTP response code after redirect to non-ascii domain name

折月煮酒 提交于 2020-01-06 06:01:45
问题 How can I get all headers for domain redirecting to non-ASCII domain? Related question The domain www.sendevinci.co.il redirecting to non-ASCII domain www.מגשי-אירוח.co.il. My code is: $url = 'http://www.sendevinci.co.il'; $options['http'] = array( 'method' => "HEAD", 'ignore_errors' => 1, 'header' => "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" . "Accept-Language: en-US,en;q=0.8\r\n". "Keep-Alive: timeout=3, max=10\r\n", "Connection: keep-alive", 'user_agent'

IMAP search for non-ascii characters

和自甴很熟 提交于 2020-01-05 13:08:26
问题 What is the COMMAND used to search for non ascii or Japanese characters in IMAP GMAIL server? 回答1: The correct way is to use a CHARSET UTF-8 SEARCH with a literal. For example (each line ends with a \r\n): > tag UID SEARCH CHARSET UTF-8 TEXT {4} < + go ahead > term < * SEARCH 700 701 702 < tag OK SEARCH done term should be UTF-8 encoded, and the 4 should be the length of the search therm, in bytes after encoding. For example, to search for the term 日本 which is \xE6\x97\xA5\xE6\x9C\xAC in UTF

Python: ascii codec can't encode en-dash

China☆狼群 提交于 2020-01-03 18:55:31
问题 I'm trying to print a poem from the Poetry Foundation's daily poem RSS feed with a thermal printer that supports an encoding of CP437. This means I need to translate some characters; in this case an en-dash to a hyphen. But python won't even encode the en dash to begin with. When I try to decode the string and replace the en-dash with a hyphen I get the following error: Traceback (most recent call last): File "pftest.py", line 46, in <module> str = str.decode('utf-8') File "/usr/lib/python2.7

French accents in MATLAB gui

ε祈祈猫儿з 提交于 2020-01-02 07:21:09
问题 I'm working on a MATLAB program with a gui. I want to have text labels and buttons in french, but it doesn't work. For example, the word 'Paramètres' in the code becomes Paramètres on the gui. I checked the file encoding and it's utf-8. What can I do to fix that? Here's a simple example of one command that I used in the code: tab2 = uitab('v0', hTabGroup, 'title','Paramètres des canaux'); Thanks. 回答1: How about using HTML?: figure hTabGroup = uitabgroup; drawnow; tab2 = uitab('v0',hTabGroup,

Reading accented filenames in R using list.files

不想你离开。 提交于 2020-01-01 12:17:11
问题 I am reading county geojson files provided here into R Studio (R 3.1, Windows 8) for each of the states. I am using list.files() function in R. For state PR, which has many counties with accented (Spanish) names viz. Bayamón.geo.json, Añasco.geo.json. The function list.files() returns shortened form of file names like An~asco.geo.json, Bayamo´n.geo.json. And when in the next step I try to read the actual file using above filenames. I get an error that these files don't exist. I was using

Reading accented filenames in R using list.files

别等时光非礼了梦想. 提交于 2020-01-01 12:17:10
问题 I am reading county geojson files provided here into R Studio (R 3.1, Windows 8) for each of the states. I am using list.files() function in R. For state PR, which has many counties with accented (Spanish) names viz. Bayamón.geo.json, Añasco.geo.json. The function list.files() returns shortened form of file names like An~asco.geo.json, Bayamo´n.geo.json. And when in the next step I try to read the actual file using above filenames. I get an error that these files don't exist. I was using

PHP file_exists with accent returns false

蓝咒 提交于 2019-12-30 18:06:59
问题 I have two folders, Folder and Folderé . The second one could not be catch by PHP. Here is my test: <?php $dir = 'D:\wamp\www\test\data\Folder'; var_dump(file_exists($dir)); // true $dir = 'D:\wamp\www\test\data\Folderé'; var_dump(file_exists($dir)); // false ?> How to fix it? 回答1: This works like charm <?php $dir = 'D:\wamp\www\test\data\Folderé'; var_dump(file_exists((utf8_decode($dir)))); 来源: https://stackoverflow.com/questions/19200750/php-file-exists-with-accent-returns-false

check for non ascii characters in matlab

半腔热情 提交于 2019-12-25 08:16:32
问题 i have a result string that sometimes hold non ascii values. These non ascii values cause trouble so i need to check for their presence in the result string. i tried with these two methods if (regexpi(result , ^\s\x{20}-\x{7e})) display('non ascii'); end and if any(result < 128) else display('non ascii'); end but it didn't work. Any help is greatly appreciated. 回答1: small tweak to the above: if all(result < 128) else display('non ascii'); end or if any(result > 127) display('non ascii'); end

Encoding/decoding non-ASCII character when using Python Pandas

丶灬走出姿态 提交于 2019-12-25 07:39:33
问题 I have some data with non-ASCII characters. I attempted to take care of it using the following: # coding=utf-8 import pandas as pd from pandas import DataFrame, Series import sys import re reload(sys) sys.setdefaultencoding('latin1') Though I have identified some records still giving me encoding/decoding problem. I have copied and pasted one of the problematic record (containing the name and location columns of the record) as below: 'Eugène Badeau' 'E, Québec (county/comté), Quebec, Canada