encoding

Difference between Encoding and collation?

ぐ巨炮叔叔 提交于 2019-12-28 12:04:36
问题 I have seen certain questions and bugs related to encoding and collation . Could anyone of the visitors explain the difference in MySQL domain? 回答1: Encoding refers to that character set used. Collation determines the sort order. See: http://dev.mysql.com/doc/refman/5.5/en/charset-general.html 回答2: Excellent answers found here, at programmers.SE: collation defines the behaviour of comparison operators: =, >, <, <=, >= ... 回答3: I think following qualifies as a better definition for Encoding

Python email quoted-printable encoding problem

Deadly 提交于 2019-12-28 06:50:26
问题 I am extracting emails from Gmail using the following: def getMsgs(): try: conn = imaplib.IMAP4_SSL("imap.gmail.com", 993) except: print 'Failed to connect' print 'Is your internet connection working?' sys.exit() try: conn.login(username, password) except: print 'Failed to login' print 'Is the username and password correct?' sys.exit() conn.select('Inbox') # typ, data = conn.search(None, '(UNSEEN SUBJECT "%s")' % subject) typ, data = conn.search(None, '(SUBJECT "%s")' % subject) for num in

Unable to print russian characters

纵然是瞬间 提交于 2019-12-28 06:32:08
问题 I have a russian string which i have encoded to UTF-8 String str = "\u041E\u041A"; System.out.println("String str : " + str); When i print the string in eclipse console i get ?? Can anyone suggest how to print the russian strings to console or what i am doing wrong here? I have tried converting it to bytes using byte myArr[] = str.getBytes("UTF-8") and then new String(myArr, "UTF-8") still same problem :-( 回答1: Try this: String myString = "some cyrillic text"; byte bytes[] = myString.getBytes

PHP Mail Encodes Subject Line

谁说胖子不能爱 提交于 2019-12-28 05:52:16
问题 When I try to send a HTML encoded email from PHP, if the subject line contains special chars like "Here's the information you requested" , PHP encodes it to read "Here's the information you requested." How do I fix this? Here's what the code looks like using PHP mail(): $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: ' . $mod_params['name'] . '<' . $mod_params['email'] . '>' . "\r\n"; $headers .= 'From: <do_not

Wrote to a file using std::wofstream. The file remained empty

ぐ巨炮叔叔 提交于 2019-12-28 04:07:10
问题 I wrote the following program using VS2008: #include <fstream> int main() { std::wofstream fout("myfile"); fout << L"Հայաստան Россия Österreich Ελλάδα भारत" << std::endl; } When I tried to compile it the IDE asked me whether I wanted to save my source file in unicode, I said "yes, please". Then I run the program, and myfile appeared in my project's folder. I opened it with notepad, the file was empty. I recalled that notepad supported only ASCII data. I opened it with WordPad, it was still

jQuery send HTML data through POST

╄→尐↘猪︶ㄣ 提交于 2019-12-28 03:54:26
问题 I am using jQuery to make a POST to a PHP file with the HTML content of a div. The HTML content contain tables, inputs, smaller divs and I would like to grab the content of the main DIV and send it to the database. The only option I could think of is the POST method but I don't know if I can send plain HTML with it. Are there any other options for sending HTML content from a div to a PHP file to be inserted into MySQL ? Thanks. EDIT: I am now able to send full HTML data with jQuery's POST.

Fix incorrectly displayed encoding on an html document with php

僤鯓⒐⒋嵵緔 提交于 2019-12-28 03:00:10
问题 Is there a way to fix the characters that display improperly after running this html markup through phpquery::newDocument? There are slated double quotes around -Classics with modern Woman- in the original document that end up displaying improperly after creating the new doc with phpquery. //Original document is UTF-8 encoded $raw_html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body><p>Mr. Smith of Bangkok celebrated the “Classics with modern

What is the equivalent of JavaScript's encodeURIcomponent in PHP?

▼魔方 西西 提交于 2019-12-27 17:07:53
问题 What is the equivalent of JavaScript's encodeURIcomponent function in PHP? 回答1: Try rawurlencode. Or to be more precise: function encodeURIComponent($str) { $revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')'); return strtr(rawurlencode($str), $revert); } This function works exactly how encodeURIComponent is defined: encodeURIComponent escapes all characters except the following: alphabetic, decimal digits, - _ . ! ~ * ' ( ) 回答2: Did you try urlencode ? 回答3: function

What is the equivalent of JavaScript's encodeURIcomponent in PHP?

匆匆过客 提交于 2019-12-27 17:07:23
问题 What is the equivalent of JavaScript's encodeURIcomponent function in PHP? 回答1: Try rawurlencode. Or to be more precise: function encodeURIComponent($str) { $revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')'); return strtr(rawurlencode($str), $revert); } This function works exactly how encodeURIComponent is defined: encodeURIComponent escapes all characters except the following: alphabetic, decimal digits, - _ . ! ~ * ' ( ) 回答2: Did you try urlencode ? 回答3: function

Why declare unicode by string in python?

*爱你&永不变心* 提交于 2019-12-27 16:32:49
问题 I'm still learning python and I have a doubt: In python 2.6.x I usually declare encoding in the file header like this (as in PEP 0263) # -*- coding: utf-8 -*- After that, my strings are written as usual: a = "A normal string without declared Unicode" But everytime I see a python project code, the encoding is not declared at the header. Instead, it is declared at every string like this: a = u"A string with declared Unicode" What's the difference? What's the purpose of this? I know Python 2.6.x