encoding

Python encoding unicode utf-8

房东的猫 提交于 2020-01-07 04:53:06
问题 I'm using selenium to insert text input with german umlauts in a web formular. The declared coding for the python script is utf-8. The page uses utf-8 encoding. When i definine a string like that everything works fine: q = u"Hällö" #type(q) returns unicode ... textbox.send_keys(q) But when i try to read from a config file using ConfigParser (or another kind of file) i get malformed output in the webformular ( Hällö ). This is the code i use for that: the_encoding = chardet.detect(q)[

Django: sqlite encoding of filenames

廉价感情. 提交于 2020-01-07 04:51:07
问题 I am writing a command (to run via manage.py importfiles ) to import a given directory structure on the real file system in my self written filestorage in Django. def _handle_directory(self, directory_path, directory): for root, subFolders, files in os.walk(directory_path): for filename in files: path = os.path.join(root, filename) with open(path, 'r') as f: file_wrapper = FileWrapper(f) self.cnt_files += 1 new_file = File(directory=directory, filename=filename, file=file_wrapper, uploader

Django: sqlite encoding of filenames

帅比萌擦擦* 提交于 2020-01-07 04:51:06
问题 I am writing a command (to run via manage.py importfiles ) to import a given directory structure on the real file system in my self written filestorage in Django. def _handle_directory(self, directory_path, directory): for root, subFolders, files in os.walk(directory_path): for filename in files: path = os.path.join(root, filename) with open(path, 'r') as f: file_wrapper = FileWrapper(f) self.cnt_files += 1 new_file = File(directory=directory, filename=filename, file=file_wrapper, uploader

iMacros doesn't fill caption and tags on Tumblr image post

人走茶凉 提交于 2020-01-07 04:30:08
问题 I have a problem using iMacros within tumblr in post image section. I'm using a macbook with OS X Yosemite 10.10.4 and Firefox 40.0.2 and this is my problem: no caption or tags content is being added when I process my code which is this: VERSION BUILD=8920312 RECORDER=FX TAB T=1 TAG POS=1 TYPE=I ATTR=CLASS:icon_post_photo&&TXT: TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:photo CONTENT=/Users/me/Desktop/blabla.jpg TAG POS=1 TYPE=P ATTR=TXT: TAG POS=1 TYPE=P ATTR=TXT:xxxx TAG POS=3 TYPE=DIV ATTR=TXT:​

UTF-8 encoding issue in php, special characters

為{幸葍}努か 提交于 2020-01-07 04:15:47
问题 I am trying to recreate a string but I am having issues with the utf-8 encoding (I guess?) I am using the code below to format a string $pre_subject = (strip_tags(html_entity_decode($temp_subject))); $pre_subject = str_replace('Â', '', $pre_subject); $pre_subject = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $pre_subject); The problem is that instead of getting the result as in the 1st sentence below, I get a result as the second one. 1st. summary: SHANGHAI room - Réunion 2nd. summary: SHANGHAI

Send mail in oracle with UTF-8 encoding in subject

好久不见. 提交于 2020-01-07 03:53:12
问题 I need to send an email from Oracle, with special characters in a subject, like ŠŽČĐĆšžčćđ. I found some information here: https://journal.missiondata.com/sending-utf-8-email-with-oracle-d276a05cf94b My code looks like this: UTL_SMTP.helo (l_mail_conn, l_mailhost); UTL_SMTP.mail (l_mail_conn, p_sender); UTL_SMTP.rcpt (l_mail_conn, p_recipient); UTL_SMTP.open_data (l_mail_conn); UTL_SMTP.WRITE_DATA(l_mail_conn, 'From' || ': ' || p_sender || CRLF); UTL_SMTP.WRITE_DATA(l_mail_conn, 'To' || ': '

Encoding of the web page

五迷三道 提交于 2020-01-07 02:51:06
问题 I have used a free template and used it as a master page in the visual web developer. Each time I close the master page file and reopen it it will ask me for the encoding of the web page. The title is "Choose an encoding", and body is "Visual web developer was unable to determine the encoding of this file. Please choose an encoding from the list box below". How can I fix this? How can I save the file with UTF-8 encoding from the beginning. 回答1: Try putting a tag like this inside the <head>

How to display accented characters using NSMutableAttributedString?

爷,独闯天下 提交于 2020-01-07 02:49:28
问题 In my NSString , I've some accented characters and html tags, such as <i></i> . I want to display them in NSTextField with text attributes to them. When I build the attrStr, I use: NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithHTML:[text dataUsingEncoding:NSUTF8StringEncoding] options:@{NSWebPreferencesDocumentOption : webPreferences} documentAttributes:NULL]; I display the text as follow: someTextField.attributedStringValue = attrStr; But this require I know

utf8_encode and Emoji

不打扰是莪最后的温柔 提交于 2020-01-07 02:25:33
问题 I have a problem utf8 encoding. In the wordpress database, there are many emojis but when I encode, they no longer appear. There is a "?" instead that appears. Can you help me ? I think it comes from utf8_encode here is the code : $results = $connection->query($req) or die(Array()); $results->setFetchMode(PDO::FETCH_OBJ); $i = 0; $jsonArray = Array(); while($row = $results->fetch()) { $jsonArray[$i][0] = utf8_encode($row->comment_author); $jsonArray[$i][1] = utf8_encode(nl2br($row->comment

Generating YouTube-Esque IDs with an LFSR in PHP

孤街醉人 提交于 2020-01-07 02:08:24
问题 Is it possible to scale the following functions taken from https://stackoverflow.com/a/9848014/2704706 to encode/decode numbers into an 11 character string? function lfsr($x) { return ($x >> 1) ^ (($x&1) ? 0xe10000 : 0); } function to_4($x) { for($i=0;$i<24;$i++) $x = lfsr($x); $str = pack("CCC", $x >> 16, ($x >> 8) & 0xff, $x & 0xff); return base64_encode($str); } function rev_lfsr($x) { $bit = $x & 0x800000; $x = $x ^ ($bit ? 0xe10000 : 0); return ($x << 1) + ($bit ? 1 : 0); } function from