Python Forum

Full Version: character code conversions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am running into troubles with some character codes that are suppose to be ASCII or UTF-8 but they might be something else. i am sending the to another system which is rejecting them as invalid. i do not control either the source or the destination. so i want to analyze what i am getting and/or make some test conversions and/or make some test data. thus i need some tools to do this. one of the tools would take bytes and pretend they are UTF-8 and try to convert them, reporting if they are valid (and what they are) or invalid (and what is wrong). i may need to input these bytes in numeric form in octal, decimal, or hexadecimal. i may need to input them to STDIN or provide them in command line arguments.

should i look for such tools or write them?
You have to know what the other system is expecting to get and provide a proper message. How do you have no control if you are sending these characters?