Hi,

I don't know much about php, since I didn't need it. Now though I need to make one small change in .php file - change some text that gets displayed.
This text is in UTF-8 Format with letters like ā š ķ , etc I've changed text inside of this php document, but after saving and re-uploading this file letters like ā š ķ are displayed just like a s k.
I know that in html you just needed to add charset=utf-8 and those letters would display, but what do I do in .php ?
I did look around on internet , tried using this piece of code

header('Content-Type: text/plain, charset=utf-8');

but that didn't help, letters like ā š ķ are simpy displayed as a s k

How could I get this to work ?

The letters are not coming out of a database I presume. Just an echo in the php file where these letters should be displayed in a browser?
If so, you can repair the problem by re-opening the php file with a editor that understands utf-8. Under Windows you could even use notepad for this. See image.

Yes, they aren't coming out of database.

This worked, thank you, I didn't think it would be so simple ! :)

Would be nice if dreamweaver also had this simple function in save as window.

Ah dreamweaver... Never heard anything good about it.

It seems this thread is solved. Could you please mark it as solved then. Thank you.

Of course. Thanks again !

I have another problem after saving as utf-8 using notepad. Letters work, but after saving as utf-8 this error below appears:

I backed up original file of course, and after restoring problem goes away. I tried saving original file as utf-8 (nothing else, just saving) problem appears. What could be the problem here ?

Warning: Cannot modify header information - headers already sent by (output started at /home/bcgroupl/public_html/majaslapa/wp-comments-post.php:1) in /home/bcgroupl/public_html/majaslapa/wp-comments-post.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/bcgroupl/public_html/majaslapa/wp-comments-post.php:1) in /home/bcgroupl/public_html/majaslapa/wp-comments-post.php on line 89

Warning: Cannot modify header information - headers already sent by (output started at /home/bcgroupl/public_html/majaslapa/wp-comments-post.php:1) in /home/bcgroupl/public_html/majaslapa/wp-comments-post.php on line 90

Warning: Cannot modify header information - headers already sent by (output started at /home/bcgroupl/public_html/majaslapa/wp-comments-post.php:1) in /home/bcgroupl/public_html/majaslapa/wp-includes/pluggable.php on line 868

Found solution to this problem. colweb was right about saving as utf-8, but it's important to save as utf-8 without bom(which adds invisible characters to the document). I found that notepad ++ does this job really well.

i had the same problem and i've been working on it for 7 hours. wonderland and everyone - thank you !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.