Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php - translating "%C3%BC" to ü

Tags:

php

utf-8

In a page, I have this reference:

<a href="Schulte_Einf%C3%BChrung.pdf">Page</a>

I've written a function to see if the file that is referenced to exists. But in this case, the file is named

Schulte_Einführung.pdf

I know that C3 BC is the UTF-8 encoding of ü, but how can I decode %C3%BC and turn it into ü? All the usual functions like utf_decode and so on don't do anything.

I can't change the filename (because I pull it from a backup file), and I also can't change the encoding because then the page could break. So is there a way to compare Schulte_Einf%C3%BChrung.pdf and Schulte_Einführung.pdf so that they will be equal?

like image 847
Bert Avatar asked Apr 11 '14 09:04

Bert


1 Answers

I know that C3 BC is the UTF-8 encoding of ü

It isn't. It is an ASCII description of the UTF-8 encoding.

Since it is data encoded in a URL, use the urldecode function.

like image 169
Quentin Avatar answered Oct 17 '22 00:10

Quentin