[PHP] [ask] convert unknown Korean's string to readable string

2013-04-18 Thread Morning Star
Hi guys,

i have a string like this:
$string = \uc548\ub155\ud558\uc138\uc694
(Korean words that say "hello world" in English).
i got no luck when I tried with
Korean. 'UCS-2BE' to 'UTF-8' encoding conversion didn't work. i also
tried with ISO-2022-KR and EUC-KR to 'UTF-8' , but no luck either.
It should be 안녕하세요!

How can I convert that $string to Korean's character?




my regards,

Marco

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP]

2013-04-18 Thread Lester Caine

Larry Martell wrote:

Continuing in my effort to port an app from PHP version 5.1.6 to
5.3.3, the app uses this construct all over the place when building
links:



I never could find any documentation for this, but I assumed it was
some conditional thing - use $var if it's defined, otherwise use
nothing. In 5.1.6 it seems to do just that. But in 5.3.3 I'm not
getting the value of $var even when it is defined. Has this construct
been deprecated? Is there now some other way to achieve this?


There WAS a period when a number of headaches, but currently the two are now isolated!


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP]

2013-04-18 Thread Larry Martell
On Wed, Apr 17, 2013 at 5:02 PM, Micky Hulse  wrote:
> On Wed, Apr 17, 2013 at 3:59 PM, Micky Hulse  wrote:
>> You might need to turn on the short tag option
>> in your conf file.
>
> Sorry, ini file, not conf. Been a long day. :D
>
> I guess I should have asked if short tags are turned on for your 5.3.3?

That was it. Thanks!!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP]

2013-04-18 Thread Micky Hulse
On Thu, Apr 18, 2013 at 8:36 AM, Larry Martell
 wrote:
> That was it. Thanks!!

Np. Glad it helped. :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Date weirdness

2013-04-18 Thread Larry Martell
On Thu, Mar 28, 2013 at 3:40 PM, Larry Martell  wrote:
> On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples  wrote:
>>> I think I am losing my mind. I have some time zone converting code, and I
>>> just don't understand what I am seeing. Also my system seems to return the
>>> wrong time after I do some date operations on unrelated objects.
>>>
>>> This is from a machine that is in eastern time. I want to convert to, for
>>> example central time:
>>>
>>> $ndate = new Date(date("Y-m-d H:i:s"));
>>> echo $ndate->format("%Y-%m-%d %H:%M:%S");
>>> 2013-03-28 15:35:07  <- this is the correct time
>>>
>>> $ndate->setTZbyID("EDT");
>>> echo $ndate->format("%Y-%m-%d %H:%M:%S");
>>> 2013-03-28 15:35:07 <- still correct
>>>
>>> $ndate->convertTZbyID("US/Central");
>>> echo $ndate->format("%Y-%m-%d %H:%M:%S");
>>> 2013-03-28 10:35:07 <- this is wrong it should be 14:35:07
>>>
>>> $xdate = new Date(date("Y-m-d H:i:s"));
>>> echo $xdate->format("%Y-%m-%d %H:%M:%S");
>>> 2013-03-28 19:35:07 <- HUH? This is wrong - should be 15:35:07
>>>
>>> What in the world is going on here?
>>>
>>
>> I found this function a while back when I was converting UTC to EST... 
>> simple task I know, but still...
>>
>> ( I am sorry to whomever wrote this, I didn't keep the source where I found 
>> it )
>>
>> function convert_time_zone($date_time, $from_tz = 'UTC', $to_tz = 
>> 'America/Toronto')
>> {
>> $time_object = new DateTime($date_time, new DateTimeZone($from_tz));
>> $time_object->setTimezone(new DateTimeZone($to_tz));
>> return $time_object->format('Y-m-d H:i:s');
>> }
>
> I don't seem to have the DateTime object. We are running 5.1.6 and
> that was added in 5.2.0. We are getting the Date module from an
> external extension. I'll have to see about upgrading.

I've upgraded to 5.3.3, got rid of the external Date extension and
implement your solution. It's working perfectly. Thanks much!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php