Tag Archives: encoding

Python unicode doctest howto in a doctest

Another thing which has been on my stack for quite a while has been a unicode doctest howto, as I remember I was quite lost when I first tried to test encoding stuff in a doctest. So I thought the … Continue reading

Posted in Coding | Tagged , , , , , , , | Leave a comment

How to restrict the length of a unicode string

Ha, not with me! It’s a pretty common tripwire: Imagine you have a unicode string and for whatever reason (which should be a good reason, so make sure you really need this) you need to make sure that its UTF-8 … Continue reading

Posted in Coding | Tagged , , , , | 6 Comments

How to convert hex strings to binary ascii strings in python (incl. 8bit space)

As this comes across may way again and again: How do you turn a hex string like "c3a4c3b6c3bc" into a nice binary string like this: "11000011 10100100 11000011 10110110 11000011 10111100"? The solution is based on the Python 2.6 new … Continue reading

Posted in Coding | Tagged , , , , , , | Leave a comment

(URL)Encoding in python

Well, encodings are a never ending story and whenever you don’t want to waste time on them, it’s for sure that you’ll stumble over yet another tripwire. This time it is the encoding of URLs (note: even though related I’m … Continue reading

Posted in Coding | Tagged , , , , , , , , | Leave a comment

Python and encoding

Well, first real post, so let’s start easy. I’ve been working a lot with python lately, and came across a nice short How to Use UTF-8 with Python which also makes the difference between unicode and utf8 very clear. The … Continue reading

Posted in Coding | Tagged , , , | Leave a comment