A:
Stringr is having a bad day.
@0 is an int value
@1 is an int value
@2 is an int value
@3 is a string
@4 is a string
@5 is a string
@6 is an int value
@7 is a string
@8 is an int value
@9 is a string
The code is going to be implementing a badly implemented protocol. You can't see it, you can't grep for it, but it's just a big fat mess.
Q:
How to convert utf-8 string to CP-1252 and back to UTF-8 in Python?
Python has set of library functions to manipulate unicode strings in Python 2.x. For example string.decode(..) method can convert UTF-8 string to CP-1252 (a).
But what about the opposite - how to convert CP-1252 to UTF-8?
Actually what I need to do is the following:
read data from file
remove all "interesting" (e.g. dates) strings from my data and pass them to a CRM module
CRM module converts the data to CP-1252 and saves it to a database
But the question is: how to convert CP-1252 strings back to UTF-8?
A:
UTF-8 is a character encoding. You don't convert it, you just use it. When you want to represent that data as text in some other character encoding, you use the appropriate conversion method.
A CP-1252 string is a representation of Unicode characters, in some other encoding. So you don't convert a CP-1252 string to anything, you just use it. If it's a string you want to write to a file, you can open the file in a text editor (e.g. gedit) and save it as UTF-8. You don't convert it to UTF-8.
Once you have a string in UTF-8, you can save it to a file, or print it, or send it as an HTTP request. You don't convert it to anything. You just save it in the appropriate encoding, and decode it when you get it back out.
You've found the right method to convert a string from a character encoding to a different character encoding.
are there in 4960.11ug?
0. be359ba680
Related links:
Comments