/    Sign up×
Community /Pin to ProfileBookmark

Locale and Charset

Situation: I am testing some PHP/HTML code — part of it in [B]cyrillic[/B] — on a PC with [B]English Windows [/B] installed.

Problem: Can’t get all the cyrillic characters look right, NO MATTER what I do!!! Please help — I’ve googled for the solution but couldn’t find one.

Here’s the code:

[code=php]setlocale(LC_ALL, ‘Russian_Russia.1251’);[/code]
[code=html]
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html” charset=”utf-8″ />
<title>&#1069;&#1090;&#1086; &#1089;&#1090;&#1088;&#1072;&#1085;&#1080;&#1094;&#1072; &#1076;&#1083;&#1103; &#1090;&#1077;&#1089;&#1090;&#1072;.</title>
</head>
<body>
<?php echo strftime(‘&#1063;&#1080;&#1089;&#1083;&#1086;: &#37;d, &#1084;&#1077;&#1089;&#1103;&#1094;: %B, &#1076;&#1077;&#1085;&#1100; &#1085;&#1077;&#1076;&#1077;&#1083;&#1080;: %A’); ?>
</body>
</html>
[/code]

With the above code, I get the following output:
&#1063;&#1080;&#1089;&#1083;&#1086;: 26, &#1084;&#1077;&#1089;&#1103;&#1094;: &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;, &#1076;&#1077;&#1085;&#1100; &#1085;&#1077;&#1076;&#1077;&#1083;&#1080;: &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
(to be exact, what I see on [I]my[/I] screen is not squares, but black diamond shapes with question mark in them).

If I comment out ‘setlocale(….)’ in the very beginning, then I get this:
&#1063;&#1080;&#1089;&#1083;&#1086;: 26, &#1084;&#1077;&#1089;&#1103;&#1094;: January, &#1076;&#1077;&#1085;&#1100; &#1085;&#1077;&#1076;&#1077;&#1083;&#1080;: Monday
which is not right, because I need russian names of the months and weeks.

Please help! I need all russian characters look right…

Thanks in advance.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@scragarJan 26.2009 — Are you serving the pages as UTF-8?
Copy linkTweet thisAlerts:
@andkhlauthorJan 26.2009 — How do I make sure I am serving the pages as UTF-8? In php.ini, I've set default_charset to be UTF-8. Is that what you mean?
Copy linkTweet thisAlerts:
@andkhlauthorJan 27.2009 — I am still having the same problem. I have enabled all checkboxes in Control Panel -> Regional Settings -> Advanced that have to do with cyrillic, but the problem has not been solved. Please help!
×

Success!

Help @andkhl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...