Convert extended ASCII character codes to utf-8 byte codes

Viewed 12700

I'm trying to figure out how to url encode strings, character by character, when all i have are the extended ASCII codes.

For example, for codes below 128, that's pretty simple: The code for char "?" is 63, which is 3F in base 16, so the url encoding of the string "?" is "%3F".

Is it possible to do the same for > 127 char codes? For instance the code for "á" is 225 (E1 in base 16). Is it possible to get from here to the bytes %C3%A1, which constitute the url encoding of "á"? If so, which operations need to be performed?

Edit: I should have been more specific, the character set is (ISO Latin-1). It seems I should also make it clearer that this question is about a formula / way to programmatically do the conversion, not about how to urlencode a char using some library in some language.

1 Answers
Related