diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-30 17:06:00 +0400 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-30 17:06:00 +0400 |
commit | cbb23154e8b100e6297e636b7204b907a8104080 (patch) | |
tree | ed9822247909066cf0dfd2d47bbe577a3e003894 /lib/util.php | |
parent | 495f0d4b3c818fd3bdba220168d1e4f86e780857 (diff) | |
parent | 381fe4d7ef2ec90050070097926be2feed6c5ee8 (diff) |
Merge branch 'stable5' into ldap_oracle_fixes
Diffstat (limited to 'lib/util.php')
-rwxr-xr-x | lib/util.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php index 3920d0f900f..8f86d30b5ea 100755 --- a/lib/util.php +++ b/lib/util.php @@ -1,4 +1,5 @@ <?php + /** * Class for utility functions * @@ -854,4 +855,23 @@ class OC_Util { } } + /** + * Normalize a unicode string + * @param string $value a not normalized string + * @return bool|string + */ + public static function normalizeUnicode($value) { + require_once 'Patchwork/PHP/Shim/Normalizer.php'; + + if(class_exists('Patchwork\PHP\Shim\Normalizer')) { + $normalizedValue = \Patchwork\PHP\Shim\Normalizer::normalize($value); + if($normalizedValue === false) { + \OC_Log::write( 'core', 'normalizing failed for "' . $value . '"', \OC_Log::WARN); + } else { + $value = $normalizedValue; + } + } + + return $value; + } } |