I had to set my php configuration as well.
Just go to php.ini and change from
default-charset="utf-8"
to
default-charset="windows-1251"
restart the local server - and everything works now.
Pergunta
I installed a site locally on OSX. The site was developed under windows and have cyrillic (Windows) encoding for some string values.
I noted that some buttons with cyrillic values wouldn't work until I change the value to english. The button looks for this, for example:
<form action="{$REQUEST_URI}" method="POST" name="addForm" id="addForm">
...
<td colspan="2" align="center"><input type="submit" name="addDo" value="Добавить" class="btn"></td>
...
</form>
and in php I get void (false) string here:
$addDo = $_POST['addDo'];
if($addDo)
...
When I change it to
<td colspan="2" align="center"><input type="submit" name="addDo" value="Add" class="btn"></td>
It starts to work properly.
Why can this happen? The site is not my to change, therefore the question is How can I change my OSX setup to make this site works like on Windows?
P.S. This html file is fetched from php module by smarty:
$smarty->fetch('login.html');
Solução 4
I had to set my php configuration as well.
Just go to php.ini and change from
default-charset="utf-8"
to
default-charset="windows-1251"
restart the local server - and everything works now.
Outras dicas
In your php application you can try to set html header:
header("Content-type: text/html; charset=utf-8");
or
header("Content-Type:text/html; charset=windows-1251");
somewhere before your:
$smarty->fetch('login.html');
Building webpages should use either HTML entities (”
), or UTF-8 encoding. You have used Windows-1251 to create this page. You may need to re-export the entire site from windows with a UTF-8 codepage (NOT MUTF-8), or import the Windows-1251 codepage to this OSX machine.
So, if you just want to make site work locally you should firstly convert all your files to UTF-8 using iconv:
iconv -f CP-1251 -t UTF-8 original_file.html > utf8_file.html
Secondly, you need to convert databases (if they're used) to same UTF-8:
ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
And then you should set correct header before sending results to browser:
header("Content-type: text/html; charset=utf-8");
Let me know if this works for you.