How convert struct to string (valid url format) and then parse the same struct again from it?

I want to convert my structs to the "string" so I can add them to the URL and reread them later from another URL. here is how I wanted to do it, but it’s not working and I have no idea why. struct MyObject: Codable { var number: Int var title: String var arrayString: [String]… Read More How convert struct to string (valid url format) and then parse the same struct again from it?

Decode string with \x in PHP that has char encoded over 255

My problem is about string decoding. Let’s assume a string like: $str = "\xce\xbb\xc6\x9b\xc2\xac\xe2\x88\xa7\xe2\x9f\x91\xe2\x88\xa8\xe2\x9f\x87\xc3\xb7 \xe2\x82\xac\xc2\xbd\xe2\x88\x86\xc3\xb8\xe2\x86\x94\xc2\xa2\xe2\x8c\x90\xc3\xa6"; I want to decode it and to look like that: λƛ¬∧⟑∨⟇÷ €½∆ø↔¢⌐æ I tried to use utf8_encode(utf8_encode($str)); But it’s not what was expected. In python something like that works: _str = b"\xce\xbb\xc6\x9b\xc2\xac\xe2\x88\xa7\xe2\x9f\x91\xe2\x88\xa8\xe2\x9f\x87\xc3\xb7 \xe2\x82\xac\xc2\xbd\xe2\x88\x86\xc3\xb8\xe2\x86\x94\xc2\xa2\xe2\x8c\x90\xc3\xa6" _str = _str.decode() print(_str) >Solution : You… Read More Decode string with \x in PHP that has char encoded over 255

looks like python treats regular strings as unicode

Looks like python3 treats regular strings as unicode… import hashlib h= hashlib.md5() h.update (‘abcd’) cause the error: Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Unicode-objects must be encoded before hashing forcing me to do encode it before: import hashlib h= hashlib.md5() h.update (‘abcd’.encode (‘ascii’, ‘replace’)) which is tedious since the… Read More looks like python treats regular strings as unicode