summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2013-12-12 21:56:10 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2013-12-12 21:56:21 +0100
commit321584dc33d17c3d3b4131785423c6beb65c774a (patch)
treea2e4b657829785dba4eab9f9b6506dd4bf24da0c /db
parent35558e6b51ec4b1795d8243af023300c4ef2480c (diff)
fix non utf-8 strings in article body, title, guid and author
Diffstat (limited to 'db')
-rw-r--r--db/item.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/item.php b/db/item.php
index 8f516f9c6..6b5a49f15 100644
--- a/db/item.php
+++ b/db/item.php
@@ -152,6 +152,20 @@ class Item extends Entity implements IAPI {
}
+ public function fromRow(array $array) {
+ // sanitize them fucked up non utf-8 strings because PHP's glorious idea
+ // on how to handle non utf-8 srtings in json_encode is to just *BOOM*
+ // in your face, which results in a spinning wheel. Forever.
+ foreach($array as $key => $value) {
+ if($key === 'body' || $key === 'author' || $key === 'title' ||
+ $key === 'guid' || $key === 'guidHash') {
+ $array[$key] === iconv('UTF-8', 'UTF-8//IGNORE', $value);
+ }
+ }
+ parent::fromRow($array);
+ }
+
+
public function setAuthor($name) {
parent::setAuthor(strip_tags($name));
}