|
-
Sep 8th, 2005, 02:21 AM
#1
Thread Starter
Member
problem with php_java.dll
hello there,
ive been introduced to php_java.dll just recently and had it sucessfully call my java function. but i have a problem with the parameters it passes to the java method. apparently, there is no problem if the data is in normal text or numbers. however, if i try to pass a string in japanese characters it would read it as garbage characters(boxes)..is there any way i could resolve this? i really need to get the string in japanese characters also.. is there something like character-encoding that i need t set?
i hope somebody could help me with my this...
thanks..salamat..arigatou..gracias 
-
Sep 8th, 2005, 03:45 AM
#2
Re: problem with php_java.dll
If I remember correct, Japanese characters would need to be in unicode right? PHP has no support for unicode strings, but that doesn't mean you cannot display unicode characters. In effect, a unicode stirng is a byte array, however, you require two bytes per character.
So in theory, if you loop through your unicode string, extracting each two byte character , convert it to a an HTML enity and then output it, it should work:
PHP Code:
<?php
// assign the stirng here - this is unicode ABC
$unicode_string = chr(1) . chr(255) . chr(0) . 'B' . chr(0) . 'C';
$len = strlen($unicode_string);
for($x = 0; $x < $len; $x+=2) {
$byte1 = ord(substr($unicode_string, $x, 1));
$byte2 = ord(substr($unicode_string, $x+1, 1));
$unicode_character = ($byte1 << 8) | $byte2;
echo("&#$unicode_character;");
}
?>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|