0

i have a folder in windows with Arabic name (utf8) i'm trying to get this name and display it in a browser using php

$enc = mb_detect_encoding($folder);
$utf8folder = iconv($enc, "UTF-8", $folder);
echo $utf8folder;

or

echo $folder;

getting ����...

help!

3
  • 1
    What happens if you just echo it, and set your page encoding to UTF-8? What is your doctype declaration, and relevant meta tags? Commented Aug 17, 2012 at 22:20
  • Can you show us your actual doctype declaration and meta tags? Also, what headers are being sent? Commented Aug 17, 2012 at 22:29
  • i'm displaying on an html page with meta: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> so it is already utf-8 Commented Aug 17, 2012 at 22:32

1 Answer 1

1

Add this as the first line of your php script and try:

header('Content-Type: text/html; charset=UTF-8');
Sign up to request clarification or add additional context in comments.

9 Comments

i'm displaying on an html page with meta: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> so it is already utf-8
@user1576848, Did you even try his suggestion?
what does $enc say the encoding is?
@user1576848, Can you provide a link to this page?
@Brad.. actually it's localhost... no online page
|

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.