sabre-io / dav

sabre/dav is a CalDAV, CardDAV and WebDAV framework for PHP
http://sabre.io
BSD 3-Clause "New" or "Revised" License
1.53k stars 346 forks source link

Sabre_VObject_Property does not serialize UTF-8 encoded strings properly #86

Closed evert closed 12 years ago

evert commented 12 years ago

Original author: zeguigui...@gmail.com (December 07, 2011 10:52:03)

When using UTF-8 properties serialize may cut the string at the wrong offset breaking the UTF8 chars.

Using mb_functions should solve this issue (tryed to use overloading but this did not solve the problem).

Original issue: http://code.google.com/p/sabredav/issues/detail?id=174

evert commented 12 years ago

From lars.kne...@gmail.com on January 02, 2012 20:42:30: I also just stumbled about this problem. I solved it using the iconv_* functions.

diff --git a/tine20/library/Sabre/VObject/Property.php b/tine20/library/Sabre/VObject/Property.php index 95aa4d3..add2aa5 100644 --- a/tine20/library/Sabre/VObject/Property.php +++ b/tine20/library/Sabre/VObject/Property.php @@ -162,19 +162,19 @@ }

     $str.=':' . $this->addSlashes($this->value);

     $out = '';
evert commented 12 years ago

From evert...@gmail.com on January 03, 2012 16:40:36: Thanks for the bug report.

I'm going to use mbstring_substr instead. iconv is incredibly slow. Just gotta write a unittest for this.

evert commented 12 years ago

From evert...@gmail.com on January 03, 2012 16:56:07: This issue was closed by revision c3e585eff99b.