Re: [PHP] Japanese Language

2004-02-13 Thread - Edwin -
Once upon a time, KidLat Ngayon wrote:

snip
whenever i've open the file in staroffice, it can
read the nihongo, however when i open it in microsoft
office, it turns out that the nihongo are
something like a garbage character.
/snip

*Maybe* the problem lies with the fact that the file was saved 
(encoded) in EUC-JP and MS Office is trying to open it using SJIS 
whereas StarOffice is using the correct encoding...

This should help: http://www.php.net/mbstring

--

- E -

I may have invented it [Ctrl-Alt-Delete],
 but Bill made it famous. - David Bradley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Japanese Language

2004-02-08 Thread KidLat Ngayon
Dear Mr. Ray,

Before anything else, I would like to thank you for
your repsonse. Anyway, as far as the MSWindows is
concern, all the language, system and specification
are all in Japanese System. And for the Database,
here's the variables from the MySQL:

|
| language|
/mysql/share/mysql/japanese/  
  
  
   |

  
  
  
|
| character_sets  | latin1 big5 czech
euc_kr gb2312 gbk sjis tis620 ujis dec8 dos german1
hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew
win1251 estonia hungarian koi8_ukr win1251ukr greek
win1250 croat cp1257 latin5
|

Hope to hear from you again Mr. Hunter

regards,

erwin


--- Ray Hunter [EMAIL PROTECTED] wrote:
 On Thu, 2004-02-05 at 19:39, KidLat Ngayon wrote:
  my problem is the language from my database, they
  inputted some english and japanese language
  
  whenever i've open the file in staroffice, it can
 read
  the nihongo, however when i open it in microsoft
  office, it turns out that the nihongo are
 something
  like a garbage character.
  
  any suggestions would highly appreciated
 thanks
  and best regards
 
 Is your database set up to handle the lang type? Is
 excel set up with
 the lang type as well?
 
 --
 Ray
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Japanese Language

2004-02-05 Thread KidLat Ngayon
Greetings

i would just like to ask a favor regarding on
php-mysql-excell format
i'm using the php as my programming language with the
following information:

System SunOS repair-c 5.9
PHP Version 4.3.2

and for mysql as my database, its:
mysqladmin  Ver 8.23 Distrib 3.23.58

below is the php script that i used to get the data
from the database and save it as excell document.

my problem is the language from my database, they
inputted some english and japanese language

whenever i've open the file in staroffice, it can read
the nihongo, however when i open it in microsoft
office, it turns out that the nihongo are something
like a garbage character.

any suggestions would highly appreciated thanks
and best regards


erwin


?php

//EDIT YOUR MySQL Connection Info:
$DB_Server = ;//your MySQL Server 
$DB_Username = ;  //your MySQL User
Name 
$DB_Password = ;//your MySQL
Password 
$DB_DBName = ;//your MySQL Database Name

$DB_TBLName = ;//your MySQL
Table Name 


//DEFINE SQL QUERY:
//you can use just about ANY kind of select statement
you want - 
//edit this to suit your needs!
$sql = Select * from $DB_TBLName;


//create MySQL connection
$Connect = @mysql_connect($DB_Server, $DB_Username,
$DB_Password)
or die(Couldn't connect to MySQL:br .
mysql_error() . br . mysql_errno());
//select database
$Db = @mysql_select_db($DB_DBName, $Connect)
or die(Couldn't select database:br .
mysql_error(). br . mysql_errno());
//execute query
$result = @mysql_query($sql,$Connect)
or die(Couldn't execute query:br .
mysql_error(). br . mysql_errno());


$count = mysql_num_fields($result);

for ($i = 0; $i  $count; $i++){
$header .= mysql_field_name($result, $i).\t;
}

while($row = mysql_fetch_row($result)){
  $line = '';
  foreach($row as $value){
if(!isset($value) || $value == ){
  $value = \t;
}else{
# important to escape any quotes to preserve them in
the data.
  $value = str_replace('', '', $value);
# needed to encapsulate data in quotes because some
data might be multi line.
# the good news is that numbers remain numbers in
Excel even though quoted.
  $value = '' . $value . '' . \t;
}
$line .= $value;
  }
  $data .= trim($line).\n;
}
# this line is needed because returns embedded in the
data have \r
# and this looks like a box character in Excel
  $data = str_replace(\r, , $data);


# Nice to let someone know that the search came up
empty.
# Otherwise only the column name headers will be
output to Excel.
if ($data == ) {
  $data = \nno matching records found\n;
}

# This line will stream the file to the user rather
than spray it across the screen
header(Content-type: application/octet-stream);

# replace excelfile.xls with whatever you want the
filename to default to
header(Content-Disposition: attachment;
filename=hello.xls);
header(Pragma: no-cache);
header(Expires: 0);

echo $header.\n.$data;
?



__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Japanese Language

2004-02-05 Thread Ray Hunter
On Thu, 2004-02-05 at 19:39, KidLat Ngayon wrote:
 my problem is the language from my database, they
 inputted some english and japanese language
 
 whenever i've open the file in staroffice, it can read
 the nihongo, however when i open it in microsoft
 office, it turns out that the nihongo are something
 like a garbage character.
 
 any suggestions would highly appreciated thanks
 and best regards

Is your database set up to handle the lang type? Is excel set up with
the lang type as well?

--
Ray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php