Skip to content

Commit

Permalink
Hotfix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
vuthaihoc committed Oct 1, 2021
1 parent d771c2c commit 483c357
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

require_once __DIR__ . "/../vendor/autoload.php";

$vf = "trong khu vùc c«ng ®· diÔn ra. T¸c ®éng cña c¸c cuéc c¶i c¸ch nµy kh«ng chØ lµ";
$vf = "ÑÖÙC HIEÁU SINH YÙ HAØNH, KHAÅU HAØNH, THAÂN HAØNH";

echo \StupidDev\ViEncoder\Encoder\Detector::usingCode( $vf);

Expand Down
8 changes: 4 additions & 4 deletions src/Encoder/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ public static function changeEncode($string, $targetEncode, $sourceEncode = null
$sourceCharSet = self::$maps[ $sourceEncode ];

$count = count($targetCharSet) - 1;
for ($i = $count; $i > 0; $i--)
for ($i = $count; $i >= 0; $i--)
{
$char = $sourceCharSet[$i];
$string = str_replace($char, '::'.$i.'::', $string);
$string = str_replace($char, '::'.($i+1).'::', $string);
}
for ($i = $count; $i > 0; $i--)
for ($i = $count; $i >= 0; $i--)
{
$char = $targetCharSet[$i];
$string = str_replace('::'.$i.'::', $char, $string);
$string = str_replace('::'.($i+1).'::', $char, $string);
}

return $string;//strtr( $string, $parse_array );
Expand Down
2 changes: 1 addition & 1 deletion src/Encoder/Detector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Detector {
private static $patterns = [
Code::CHARSET_TCVN3 => '/\w­[¬íêîëì]|®[¸µ¹¶·Ê¾»Æ¼½ÌÑÎϪÕÒÖÓÔÝ×ÞØÜãßäáâ«èåéæç¬íêîëìóïôñòøõùö]/u',
Code::CHARSET_VNI_WIN => '/[öô][ùøïûõ]|oa[ëùøïûõ]|ñ[aoeuôö][äàáåãùøïûõ]/iu',
Code::CHARSET_VNI_WIN => '/[öô][ùøïûõ]|[oa][ëùøïûõä]|ñ[aoeuôö][äàáåãùøïûõ]/iu',
Code::CHARSET_VIQR => '/u[\+\*]o[\+\*]|dd[aoe][\(\^~\'`]|[aoe]\^[~`\'\.\?]|[uo]\+[`\'~\.\?]|a\([\'`~\.\?]/iu',
Code::CHARSET_UNICODE => '/[Ạ-ỹ]/',
Code::CHARSET_VISCII => '/\wß[½¾¶þ·Þ]|ð[áàÕäã¤í¢£ÆÇè©ë¨êª«®¬­íì¸ïîóò÷öõô¯°µ±²½¾¶þ·ÞúùøüûÑ×ñØ]/u',
Expand Down

0 comments on commit 483c357

Please sign in to comment.