Encoding is a set of predefined rules to reversibly transform a piece of information in a certain representation into a completely different representation. The other way round is called decoding.
630
votes
7answers
334k views
How to encode a URL in JavaScript?
How do you safely encode a URL using JavaScript such that it can be put into a GET string?
var myUrl = "http://example.com/index.html?param=1&anotherParam=2";
var myOtherUrl = ...
360
votes
5answers
97k views
Best practice: escape, or encodeURI / encodeURIComponent
When encoding a query string to be sent to a web server - what is the best practice to use from javascript:
Use escape:
escape("% +&=");
OR
use encodeURI() / encodeURIComponent()
...
187
votes
8answers
97k views
What is the best collation to use for MySQL (with PHP)
I'm wondering if there is a "best" choice for collation in MySQL for a general website where you aren't 100% of what will be entered? I understand that all the encodings should be the same, such as ...
140
votes
8answers
69k views
How to get UTF-8 working in java webapps?
I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ЦжФ for special cases.
My setup is the ...
104
votes
16answers
99k views
How can I detect the encoding/codepage of a text file
In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage.
...
93
votes
19answers
86k views
Detect encoding and make everything UTF-8
I'm reading out lots of texts from various RSS feeds and inserting them into my database.
Of course, there are several different character encodings used in the feeds, e.g. UTF-8 and ISO-8859-1.
...
87
votes
21answers
54k views
Microsoft Excel mangles Diacritics in .csv files?
I am programmatically exporting data (using PHP 5.2) into a .csv test file.
Example data: Numéro 1 (note the accented e).
The data is utf-8 (no prepended BOM)
When I open this file in MS excel is ...
82
votes
5answers
64k views
What encoding/code page is cmd.exe using
When I open cmd.exe in Windows, what encoding is it using? How can I check which encoding it is currently using? Does it depend on my regional setting or are there any environment variables to check?
...
81
votes
6answers
22k views
Setting the correct encoding when piping stdout in python
When piping the output of a python program, the python interpreter gets confused about encoding and sets it to None. This means a program like this:
# -*- coding: utf-8 -*-
print "åäö"
will work ...
74
votes
20answers
107k views
Excel to CSV with UTF8 encoding
I have an Excel file that has some Spanish characters (tildes, etc.) that I need to convert to a CSV file to use as an import file. However, when I do Save As CSV it mangles the "special" Spanish ...
73
votes
4answers
20k views
Android Replace “…” with ellipsis character
Since AVD tools 16 I'm getting this warning:
Replace "..." with ellipsis character (..., …) ?
in my strings.xml
at this line
<string name="searching">Searching...</string>
...
72
votes
1answer
27k views
How to configure encoding in maven
When I run maven install on my multi module maven project I always get the following output:
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
...
60
votes
3answers
17k views
Why does Python print unicode characters when the default encoding is ASCII?
From the Python 2.6 shell:
>>> import sys
>>> print sys.getdefaultencoding()
ascii
>>> print u'\xe9'
é
>>>
I expected to have either some gibberish or an Error ...
59
votes
7answers
25k views
UTF-8 vs Unicode
I have heard conflicting opinions from people - according to wikipedia, see here
They are the same thing, aren't they? Can someone clarify?
56
votes
2answers
23k views
How to store custom objects in NSUserDefaults
Alright, so I've been doing some poking around, and I realize my problem, but I don't know how to fix it. I have made a custom class to hold some data. I make objects for this class, and I need to ...