encoding

How do I properly store and retrieve internationalized Strings in properties files?

I'm experimenting with internationalization by making a Hello World program that uses properties files + ResourceBundle to get different strings. Specifically, I have a file "messages_en_US.properties" that stores "hello.world=Hello World!", which works fine of course. I then have a file "messages_ja_JP.properties" which I've tried all...

Generate User Specific 1 Time Coupon Code

So I need to generate a code that can be tied to a specific user/prospect with a dollar amount built into it. It needs to be reversible so that client application can confirm the validity of the code and apply the discount a manager intends. I'd like to make the code as short as possible but it needs to be well obfuscated so that the s...

Dealing with a string containing multiple character encodings.

I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me. I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include multiple character e...

How to use Special Chars in Java/Eclipse

How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse? Wenn I try to use them directly, i.e. in the source code, Eclipse cannot save the file: What can I do? Edit: How can I find the unicode escape sequence? ...

How to base64 encode a PDF file in Python

How should I base64 encode a PDF file for transport over XML-RPC in Python? ...

C# : Characters do not display well when in Console, why?

The picture below explains all: The variable textInput comes from File.ReadAllText(path); and characters like : ' é è ... do not display. When I run my UnitTest, all is fine! I see them... Why? ...

Repairing wrong encoding in XML files

One of our providers are sometimes sending XML feeds that are tagged as UTF-8 encoded documents but includes characters that are not included in the UTF-8 charset. This causes the parser to throw an exception and stop building the DOM object when these characters are encountered: DocumentBuilder.parse(ByteArrayInputStream bais) throws...

URL-Encoded Angle Brackets in URL?

Hi, I'm working on a legacy app and for whatever reason it's trying to stuff URL-encoded angle brackets into a URL. For example, to get a URL ending with "<sometext>": http://somesite.com/somefolder/%3csometext%3e When the above URL-encoded URL is fetched, it generates a 400 error (Bad Request) on IIS6 and I can't quite figure out why...

How can I URL encode a string in Excel VBA?

Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality? ...

How to I root out a mystery character encoding problem in a Wordpress blog?

I am attempting to start a new Wordpress blog. I am seeing funny characters in some browsers but not others instead of single quotes, double quotes and ellipses. Things I already thought of: The HTML template page for output itself is set to UTF-8 The admin page is UTF-8 The MySQL database tables where the data is stored are UTF-8 en...

Putting Copyright Symbol into a Python File

I need to include a copyright statement at the top of every Python source file I produce: # Copyright: © 2008 etc. However, when I then run such a file I get this message: SyntaxError: Non-ASCII character '\xa9' in file MyFile.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details. Apparen...

Encoding problem with HttpWebResponse

Here is a snippet of the code : HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(request.RawUrl); WebRequest.DefaultWebProxy = null;//Ensure that we will not loop by going again in the proxy HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse(); string charSet = response.CharacterSet; Encoding encoding; if (S...

convert string to byte[] in java

We try to convert from string to Byte[] using the following Java code: String source = "0123456789"; byte[] byteArray = source.getBytes("UTF-16"); We get a byte array of length 22 bytes, we are not sure where this padding comes from? how do i get an array of length 20? ...

Encoding conversion in java

is there any free java library which i can use to convert string in one encoding to other encoding, something like icnov in php? i'm using java version 1.3 ...

OS X file duplication converts text encoding by default

All the PHP files in my workspace are encoded in Unicode (UTF-8, no BOM). I often duplicate an existing source file to use as a base for a new script. Invariably (with Path Finder or the original Finder), OS X will convert the encoding of the duplicate file to Western (Mac OS Roman). Is there any way to make OS X behave and not convert ...

how do I implement a custom code page used by a serial device so I can convert text to it in Python ?

I have a scrolling LED sign that takes messages in either ASCII or (using some specific code) characters from a custom code page. For example, the euro sign should be sent as <U00> and ä is <U64> (You can find the full code page in the documentation) My question is, what is the most pythonic way to implement this custom code page...

How to get correctly-encoded HTML from the clipboard?

Has anyone noticed that if you retrieve HTML from the clipboard, it gets the encoding wrong and injects weird characters? For example, executing a command like this: string s = (string) Clipboard.GetData(DataFormats.Html) Results in stuff like: <FONT size=-2>  <A href="/advanced_search?hl=en">Advanced Search</A><BR>  <A href="/...

Double/incomplete Parameter Url Encoding

In my web app, my parameters can contain all sorts of crazy characters (russian chars, slashes, spaces etc) and can therefor not always be represented as-is in a URL. Sending them on their merry way will work in about 50% of the cases. Some things like spaces are already encoded somewhere (I'm guessing in the Html.BuildUrlFromExpression ...

How to use SQL_ASCII encoding in a rails application?

I have to connect to a legacy postgre database wich has ENCODING = 'SQL_ASCII';. How do I set this encoding in my rails app? ...

How does Base 64 handle binary data with zeroes at the end

As I understand the spec, a Base64 encoder a) takes the source binary, and pads it out with zeroes to be a multiple of 24 bytes long. b) it then transcodes it, six bits at a time, to the target set of 64 characters (A..Z, a..z, 0..9, +, -). If it finds the last two bytes (16 bits) have been zero-padded, the last two characters are tra...