Display Hebrew strings in php

My code is as follows:

<?php echo "בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ."; 

Web browser output:

 ×'ְּרֵ×ש×ִית, ×'Ö¼Ö¸×¨Ö¸× ×ֱלֹ×"Ö´×™×, ×ֵת ×"ַשּ×ָמַיִ×, וְ×ֵת ×"Ö¸×ָרֶץ. 

What steps should be taken to show the browser:

 בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ. 
+5
source share
1 answer

You need to tell the browser that your page is encoded in utf8. This is done by setting the Content-type -header:

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

Use text/html instead of text/plain if you want to print an html page.

+4
source

All Articles