Encoding of multilanguage file
Posted: Wed Feb 27, 2008 8:29 pm
What is the encoding of multilanguage file? I wanted to translate JFileUpload to Russian, but I failed 
JFileUpload products support forum.
http://www.jfileupload.com/support/forums/
http://www.jfileupload.com/support/forums/viewtopic.php?f=2&t=39
Code: Select all
taskoutput.usage=\u00d0\u0178\u00d0\u00b5\u00d1\u20ac\u00d0\u00b5\u00d1\u201a\u00d0\u00b0\u00d1\u2030\u00d0\u00b8\u00d1\u201a\u00d0\u00b5 \u00d1\u201e\u00d0\u00b0\u00d0\u00b9\u00d0\u00bb\u00d1\u2039 \u00d1\ufffd \u00d0\u00b2\u00d0\u00b0\u00d1\u02c6\u00d0\u00b5\u00d0\u00b3\u00d0\u00be \u00d0\u00ba\u00d0\u00be\u00d0\u00bc\u00d0\u00bf\u00d1\u0152\u00d1\u017d\u00d1\u201a\u00d0\u00b5\u00d1\u20ac\u00d0\u00b0
Code: Select all
Перетащите файлы � вашего компьютераCode: Select all
native2ascii.exe -encoding UTF-8 inputfilename.txt outputfilename.txtCode: Select all
function utf8_to_unicode($str) {
$unicode = array();
$values = array();
$lookingFor = 1;
for ($i = 0; $i < strlen($str); $i++ ) {
if ($str[$i] == " ") {
$unicode[] = " ";
} else {
$thisValue = ord( $str[ $i ] );
if ( $thisValue < ord('A') ) {
// exclude 0-9
if ($thisValue >= ord('0') && $thisValue <= ord('9')) {
// number
$unicode[] = chr($thisValue);
}
else {
$unicode[] = '\\'.dechex($thisValue);
}
} else {
if ($thisValue < 128){
$unicode[] = $str[ $i ];
} else {
if ( count( $values ) == 0 ) $lookingFor = ( $thisValue < 224 ) ? 2 : 3;
$values[] = $thisValue;
if ( count( $values ) == $lookingFor ) {
$number = ( $lookingFor == 3 ) ?
( ( $values[0] % 16 ) * 4096 ) + ( ( $values[1] % 64 ) * 64 ) + ( $values[2] % 64 ):
( ( $values[0] % 32 ) * 64 ) + ( $values[1] % 64 );
$number = dechex($number);
$unicode[] = (strlen($number)==3)?"\\u0".$number:"\\u".$number;
$values = array();
$lookingFor = 1;
} // if
} // if
}
}
} // for
return implode("", $unicode);
}