diff options
author | Jeremy Dorn <jeremy@jeremydorn.com> | 2013-03-07 17:57:28 -0800 |
---|---|---|
committer | Jeremy Dorn <jeremy@jeremydorn.com> | 2013-03-07 17:57:28 -0800 |
commit | 17fdbb8bd358d226dc1a9691c2245f041d72e3d3 (patch) | |
tree | 30f1607fb97b993cb4370334f00dbdb1dd5cf8c8 | |
parent | d4c4db359863c8f597805076531df627f78f97a8 (diff) | |
download | sql-formatter-17fdbb8bd358d226dc1a9691c2245f041d72e3d3.zip sql-formatter-17fdbb8bd358d226dc1a9691c2245f041d72e3d3.tar.gz sql-formatter-17fdbb8bd358d226dc1a9691c2245f041d72e3d3.tar.bz2 |
Fixing utf-8 encoding bug with PHP 5.3. Fixes #27
-rw-r--r-- | lib/SqlFormatter.php | 2 | ||||
-rw-r--r-- | tests/format-highlight.html | 4 | ||||
-rw-r--r-- | tests/highlight.html | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/SqlFormatter.php b/lib/SqlFormatter.php index f0b5be3..6c4be7c 100644 --- a/lib/SqlFormatter.php +++ b/lib/SqlFormatter.php @@ -637,7 +637,7 @@ class SqlFormatter protected static function highlightToken($token) { $type = $token[self::TOKEN_TYPE]; - $token = htmlentities($token[self::TOKEN_VALUE]); + $token = htmlentities($token[self::TOKEN_VALUE],ENT_COMPAT,'UTF-8'); if($type===self::TOKEN_TYPE_BOUNDARY) { return self::highlightBoundary($token); diff --git a/tests/format-highlight.html b/tests/format-highlight.html index cec7316..f64da33 100644 --- a/tests/format-highlight.html +++ b/tests/format-highlight.html @@ -734,7 +734,7 @@ ( <span style="color: green;">3</span><span >,</span> <span style="color: green;">2</span><span >,</span> - <span style="color: blue;">'Réassort'</span> + <span style="color: blue;">'Réassort'</span> )</pre> <pre style="color: black; background-color: white;"><span style="font-weight:bold;">INSERT</span> <span style="font-weight:bold;">INTO</span> <span style="color: purple;">`PREFIX_meta_lang`</span> ( @@ -780,7 +780,7 @@ <span style="font-weight:bold;">WHERE</span> <span style="color: purple;">`page`</span> <span >=</span> <span style="color: blue;">'authentication'</span> )<span >,</span> - <span style="color: blue;">'Autenticación'</span><span >,</span> + <span style="color: blue;">'Autenticación'</span><span >,</span> <span style="color: blue;">'autenticacion'</span> )</pre> diff --git a/tests/highlight.html b/tests/highlight.html index 1519b30..b18d77b 100644 --- a/tests/highlight.html +++ b/tests/highlight.html @@ -219,12 +219,12 @@ (<span style="color: green;">2</span><span >,</span> <span style="color: green;">1</span><span >,</span> <span style="color: blue;">'Missing Stock Movement'</span>)<span >,</span> (<span style="color: green;">2</span><span >,</span> <span style="color: green;">2</span><span >,</span> <span style="color: blue;">'Mouvement de stock manquant'</span>)<span >,</span> (<span style="color: green;">3</span><span >,</span> <span style="color: green;">1</span><span >,</span> <span style="color: blue;">'Restocking'</span>)<span >,</span> -(<span style="color: green;">3</span><span >,</span> <span style="color: green;">2</span><span >,</span> <span style="color: blue;">'Réassort'</span>)</pre> +(<span style="color: green;">3</span><span >,</span> <span style="color: green;">2</span><span >,</span> <span style="color: blue;">'Réassort'</span>)</pre> <pre style="color: black; background-color: white;"><span style="font-weight:bold;">INSERT</span> <span style="font-weight:bold;">INTO</span> <span style="color: purple;">`PREFIX_meta_lang`</span> (<span style="color: purple;">`id_lang`</span><span >,</span> <span style="color: purple;">`id_meta`</span><span >,</span> <span style="color: purple;">`title`</span><span >,</span> <span style="color: purple;">`url_rewrite`</span>) <span style="font-weight:bold;">VALUES</span> (<span style="color: green;">1</span><span >,</span> (<span style="font-weight:bold;">SELECT</span> <span style="color: purple;">`id_meta`</span> <span style="font-weight:bold;">FROM</span> <span style="color: purple;">`PREFIX_meta`</span> <span style="font-weight:bold;">WHERE</span> <span style="color: purple;">`page`</span> <span >=</span> <span style="color: blue;">'authentication'</span>)<span >,</span> <span style="color: blue;">'Authentication'</span><span >,</span> <span style="color: blue;">'authentication'</span>)<span >,</span> (<span style="color: green;">2</span><span >,</span> (<span style="font-weight:bold;">SELECT</span> <span style="color: purple;">`id_meta`</span> <span style="font-weight:bold;">FROM</span> <span style="color: purple;">`PREFIX_meta`</span> <span style="font-weight:bold;">WHERE</span> <span style="color: purple;">`page`</span> <span >=</span> <span style="color: blue;">'authentication'</span>)<span >,</span> <span style="color: blue;">'Authentification'</span><span >,</span> <span style="color: blue;">'authentification'</span>)<span >,</span> -(<span style="color: green;">3</span><span >,</span> (<span style="font-weight:bold;">SELECT</span> <span style="color: purple;">`id_meta`</span> <span style="font-weight:bold;">FROM</span> <span style="color: purple;">`PREFIX_meta`</span> <span style="font-weight:bold;">WHERE</span> <span style="color: purple;">`page`</span> <span >=</span> <span style="color: blue;">'authentication'</span>)<span >,</span> <span style="color: blue;">'Autenticación'</span><span >,</span> <span style="color: blue;">'autenticacion'</span>)</pre> +(<span style="color: green;">3</span><span >,</span> (<span style="font-weight:bold;">SELECT</span> <span style="color: purple;">`id_meta`</span> <span style="font-weight:bold;">FROM</span> <span style="color: purple;">`PREFIX_meta`</span> <span style="font-weight:bold;">WHERE</span> <span style="color: purple;">`page`</span> <span >=</span> <span style="color: blue;">'authentication'</span>)<span >,</span> <span style="color: blue;">'Autenticación'</span><span >,</span> <span style="color: blue;">'autenticacion'</span>)</pre> <pre style="color: black; background-color: white;"><span style="font-weight:bold;">LOCK</span> <span style="font-weight:bold;">TABLES</span> <span style="color: purple;">`admin_assert`</span> <span style="font-weight:bold;">WRITE</span></pre> |