logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Show Chinese Date
Author
SabinF



Joined: 03 May 2006
Posts: 37
Location: Timisoara (Romania)

PostPosted: Wed 23 May '07 0:17    Post subject: Show Chinese Date Reply with quote

Hello, I'm trying to show date in Chinese the following way:

Query: SET lc_time_names = 'zh_CN';

Query: SELECT DAYNAME('2007-01-01');

The problem is that when I output the result with PHP i get: '????'.

I tried using the htmlentities function, but with no luck. I also tried changing the charset from utf-8 to gb2312 and still nothing. Can anyone help me?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 23 May '07 9:51    Post subject: Reply with quote

There is a way to convert the characters using multibyte String functions (mb_*)
I know that this exists, but I have never worked with that.

It would be nice if you tell us how mb_* works if you are done!
Back to top
SabinF



Joined: 03 May 2006
Posts: 37
Location: Timisoara (Romania)

PostPosted: Thu 24 May '07 19:59    Post subject: Reply with quote

I don't understand how to use mbstring. Anyway, it seems that I get this output even when i use setlocale with LC_TIME to chinese and use strftime. If any one of you has any info, it would be appreciated. Thanks.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>

<body>
<?php
   setlocale(LC_TIME, "Chinese");
   echo strftime("%B");
?>
</body>
</html>
Back to top


Reply to topic   Topic: Show Chinese Date View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner