0

I have file on my server. The name contains 'Ihre Bestellung bei Ticketcorner für Swiss Indoors Basel', but 'ü' is not valid for url.

How can I make it valid or recoded?

I found mb_convert_encoding function

I tried it:

 $sImageName = mb_convert_encoding($sImageName,"ASCII");

But it returns f?r and can't save the file.

Also tried it:

$sImageName = rawurldecode($sImageName);

But both methods don't work. Maybe I need another format for it?

How can I fix it and get valid url?

Also try on page use urlencode() and i get 'f%C3%BCr' but when i open link it replace it to 'für' and it doesnt work.

Clothess Sale
  • 41
  • 1
  • 8

1 Answers1

2

When passing the data in the URL, you have to urlencode() it and then send it in the URL.

<?php

echo  urlencode('Ihre Bestellung bei Ticketcorner für Swiss Indoors Basel');

While receiving the data, you will have to urldecode() it to get back the original string.

<?php

echo  urldecode(urlencode('Ihre Bestellung bei Ticketcorner für Swiss Indoors Basel'));
nice_dev
  • 17,053
  • 2
  • 21
  • 35