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.

4
  • You mean $sImageName = mb_convert_encoding($sImageName,"UTF-8"); ? it did not solve problem Commented Apr 3, 2019 at 12:37
  • For me doesnt work Commented Apr 3, 2019 at 12:50
  • Dont understand your question.. in 'für' Commented Apr 3, 2019 at 12:54
  • Ths answer with be very useful to you Commented Apr 3, 2019 at 13:03

1 Answer 1

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'));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.