Edit report at http://pear.php.net/bugs/bug.php?id=18589&edit=1
ID: 18589
Updated by: [email protected]
Reported By: yuki at transrain dot net
Summary: Multibyte support bug.
Status: Feedback
Type: Bug
Package: Net_Growl
Operating System: Windows
Package Version: 2.2.2
PHP Version: 5.3.6
Roadmap Versions:
New Comment:
Thanks Takeshi,
My suprise came from the results I got from my growl display.
Have a look on screenshots I shared at :
http://www.laurent-laville.org/pear/pepr/Net_Growl/
Is it what you get yourself, or is it just me ?
My platform is Windows XP / PHP 5.3.5
Previous Comments:
------------------------------------------------------------------------
[2011-06-07 02:29:42] ariela
Hello Laurent
multibyte test script and test server's configures, upload to my
server.
please download from
http://transrain.net/share/net_growl_multibyte_test.tar.gz
* UTF-8 version append test code for Chinese and Korean.
Thanks in advance.
------------------------------------------------------------------------
[2011-06-06 12:15:07] farell
-Status: Open
+Status: Feedback
Hello Takeshi,
I've some problem to test your patchs in real condition.
Could you provide a test protocol (how to set/configure) a php script /
ini config (probably) to display what you're expected.
Thanks in advance
Laurent
------------------------------------------------------------------------
[2011-06-06 03:17:28] ariela
Added #patch bug:18589;patch:Gntp.php;revision:1307330248;.
------------------------------------------------------------------------
[2011-06-06 03:16:59] ariela
Added #patch bug:18589;patch:Udp.php;revision:1307330219;.
------------------------------------------------------------------------
[2011-06-06 03:11:22] ariela
Description:
------------
sendNotify method can not send multibyte(Japanese)
message.
character set encode error for utf8_encode.
please use "mb_convert_encoding($value, 'UTF-8', 'auto')"
(detect order encoding to UTF-8 encoding. set encoding detect
order by "mb_detect_order")
Patches
=========================
Net_Growl_Gntp
--- D:/develop/xampp/php/PEAR/Net/Growl/Gntp.php.orig
Mon Jun 06 10:56:26 2011
+++ D:/develop/xampp/php/PEAR/Net/Growl/Gntp.php Mon
Jun 06 11:07:53 2011
@@ -99,7 +99,7 @@
// Application-Name: <string>
// Required - The name of the application that is
registering
$data = "Application-Name: "
- . utf8_encode($this->getApplication()-
>getGrowlName())
+ . mb_convert_encoding($this->getApplication()-
>getGrowlName(), 'UTF-8', 'auto')
. "\r\n";
// Application-Icon: <url> | <uniqueid>
@@ -131,7 +131,7 @@
// Notification-Name: <string>
// Required - The name (type) of the notification
being registered
- $data .= "Notification-Name: " . utf8_encode($name)
. "\r\n";
+ $data .= "Notification-Name: " .
mb_convert_encoding($name, 'UTF-8', 'auto') . "\r\n";
// Notification-Display-Name: <string>
// Optional - The name of the notification that is
displayed to the user
@@ -215,10 +215,10 @@
*/
public function sendNotify($name, $title, $description,
$options)
{
- $appName = utf8_encode($this->getApplication()-
>getGrowlName());
- $name = utf8_encode($name);
- $title = utf8_encode($title);
- $description = utf8_encode($description);
+ $appName = mb_convert_encoding($this-
>getApplication()->getGrowlName(), 'UTF-8', 'auto');
+ $name = mb_convert_encoding($name, 'UTF-8',
'auto');
+ $title = mb_convert_encoding($title, 'UTF-8',
'auto');
+ $description = mb_convert_encoding($description,
'UTF-8', 'auto');
$priority = isset($options['priority'])
? $options['priority'] : self::PRIORITY_NORMAL;
$icon = isset($options['icon']) ? $options['icon'] :
'';
@@ -389,7 +389,7 @@
$cipherText = $data;
} else {
if (!isset($keys)) {
- $password = utf8_encode($password);
+ $password = mb_convert_encoding($password,
'UTF-8', 'auto');
$keys = $this->_genKey($password);
}
list($hash, $key) = $keys;
Net_Growl_Udp
--- D:/develop/xampp/php/PEAR/Net/Growl/Udp.php.orig
Fri Jun 03 19:31:45 2011
+++ D:/develop/xampp/php/PEAR/Net/Growl/Udp.php Mon
Jun 06 11:07:52 2011
@@ -84,7 +84,7 @@
*/
public function sendRegister()
{
- $appName = utf8_encode($this->getApplication()-
>getGrowlName());
+ $appName = mb_convert_encoding($this-
>getApplication()->getGrowlName(), 'UTF-8', 'auto');
$password = $this->getApplication()-
>getGrowlPassword();
$nameEnc = $defaultEnc = '';
$nameCnt = $defaultCnt = 0;
@@ -96,7 +96,7 @@
$defaultCnt++;
}
- $name = utf8_encode($name);
+ $name = mb_convert_encoding($name, 'UTF-8',
'auto');
$nameEnc .= pack('n', mb_strlen($name)).$name;
$nameCnt++;
}
@@ -134,11 +134,11 @@
*/
public function sendNotify($name, $title, $description,
$options)
{
- $appName = utf8_encode($this->getApplication()-
>getGrowlName());
+ $appName = mb_convert_encoding($this-
>getApplication()->getGrowlName(), 'UTF-8', 'auto');
$password = $this->getApplication()-
>getGrowlPassword();
- $name = utf8_encode($name);
- $title = utf8_encode($title);
- $description = utf8_encode($description);
+ $name = mb_convert_encoding($name, 'UTF-8',
'auto');
+ $title = mb_convert_encoding($title, 'UTF-8',
'auto');
+ $description = mb_convert_encoding($description,
'UTF-8', 'auto');
$priority = isset($options['priority'])
? $options['priority'] :
Net_Growl::PRIORITY_NORMAL;
Test script:
---------------
$growl->notify('test', "???(Japanese)", "????????(Japanese message)",
array());
Expected result:
----------------
Notification-Name: test
Notification-Title: ���(Japanese)
Notification-Text: æ?¥æ?¬èª?ã?¡ã??ã?»ã?¼ã?¸(Japanese
message)
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18589&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.