Skip to content

URL-Escapezeichen in UTF-8 wandeln

Ich stand gerade vor dem Problem, Daten aus URLs zu extrahieren. Nun kann man in eine URL nicht unmittelbar bestimmte Zeichen (Umlaute, Leerzeichen etc.) eingeben. Diese werden durch so genannte Escapezeichen markiert. Aus einem Leerzeichen wird dann %20 oder ein " wird ein %22 usw. Mein Problem bestand darin, diese Zeichen wieder zurück zu transformieren. Mit sed würde das gehen, aber einen recht hohen Aufwand darstellen. Auch weitere Programme schienen ungeeignet. Aber Maddi brachte mich auf die richtige Spur: uni2ascci. Der Aufruf ascii2uni -aJ < datei löste mein Problem. ;-)

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

LeSpocky on :

Dabei muss man aber drauf achten, dass die Zeichen in der URL im Prinzip hinter der URL-Kodierung noch unterschiedlich kodiert sein können, also dort eben in UTF-8, ISO-8859-? usw. – bin ich letztens drüber gestolpert, als ich bisschen mit libwww-perl gespielt hab. ;-)

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
BBCode format allowed
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Form options
cronjob