rtoss

Subversion Repositories:
Compare Path: Rev
With Path: Rev
/pbbs/ @ 38  →  /pbbs/ @ 39
/pbbs/u2utf8.php
@@ -1,6 +1,6 @@
<?php
function u2utf8($c) {
$str = "";
$ret = $str = '';
if ($c < 0x80) {
$str .= $c;
} else if ($c < 0x800) {
@@ -20,29 +20,29 @@
return $ret;
}
 
function utf8Encode ($source) {
$utf8Str = '';$utf8val='';
$entityArray = explode ("&#", $source);
$size = count ($entityArray);
for ($i = 0; $i < $size; $i++) {
function utf8Encode($source) {
$utf8Str = $utf8val='';
$entityArray = explode('&#', $source);
$size = count($entityArray);
for($i = 0; $i < $size; $i++) {
$utf8Substring='';
$subStr = $entityArray[$i];
$nonEntity = strstr ($subStr, ';');
if ($nonEntity !== false) {
$unicode = intval (substr ($subStr, 0, (strpos ($subStr, ';') + 1)));
$nonEntity = strstr($subStr, ';');
if($nonEntity !== false) {
$unicode = intval(substr($subStr, 0, strpos($subStr, ';') + 1));
// determine how many chars are needed to reprsent this unicode char
$utf8Substring .=u2utf8($unicode);
# for ($y = 0;$y < strlen($utf8val);$y += 3)
# $utf8Substring .= chr(substr($utf8val, $y, 3));
 
if (strlen ($nonEntity) > 1)
if(strlen ($nonEntity) > 1)
$nonEntity = substr ($nonEntity, 1); // chop the first char (';')
else
$nonEntity = '';
 
$utf8Str .= $utf8Substring . $nonEntity;
$utf8Str .= $utf8Substring . $nonEntity;
} else {
$utf8Str .= $subStr;
$utf8Str .= $subStr;
}
}
 
/pbbs/tblless2utf8.php
@@ -2,7 +2,7 @@
include_once("./u2utf8.php");
 
# Russian
function ru2utf8 ($ru,$RefCode=1){
function ru2utf8($ru,$RefCode=1){
for ($i=0; $i < strlen($ru); $i++){
$thischar=substr($ru,$i,1);
$charcode=ord($thischar);
@@ -36,7 +36,7 @@
}
 
#Windows Symbol
function ws2utf8 ($ws,$RefCode=1){
function ws2utf8($ws,$RefCode=1){
for ($i=0; $i < strlen($ws); $i++){
$thischar=substr($ws,$i,1);
$charcode=ord($thischar);
@@ -75,7 +75,7 @@
return $entities;
} else {
$wchars = '';
foreach( $unicode as $value ) $wchars .= chr($value);
foreach( $unicode as $value ) $wchars .= u2utf8($value);
return $wchars;
}
}