php-i18n Digest 21 Jul 2003 04:57:12 -0000 Issue 182

Topics (messages 583 through 587):

Re: Japanese text not displaying correctly.
        583 by: Jean-Christian IMbeault
        585 by: Dennis browne

Re$B!'(BJapanese text not displaying correctly.
        584 by: Michael Grant

Which .mo file is used by PHP gettext?
        586 by: Christophe Chisogne

Inline extraction and exhibition of large objects
        587 by: Ellis Robin (Bundaberg)

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Dennis Browne wrote:
(B>
(B> $home = "$B%[!<(B?";
(B
(BThat didn't come out right in the email. Are you sure you saved your
(Bfile in UTF-8 format?
(B
(B> Why?
(B
(BIs your browser detecting that the page is in UTF-8? Manually set you
(Bbrowser's page encoding to UTF-8 and see if that makes a difference?
(B
(BWhat browser are you using?
(B
(BJean-Christian Imbeault

--- End Message ---
--- Begin Message ---
Thanks for the reply Jean-Christian.

I'm using IE5+ and NS4+.

I did not save the file in UTF-8 format. After trying that though what
happens is odd characters appear on the first line of my page. I am
guessing from the UTF-8 signature character or something. Also the
characters do not appear correctly in NS4. 


page.php:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Language" content="ja">
</head>
<body>Home:<br>
<?php
include("lng_page_ja.php"); 

echo "home in japanese:"; 
echo "<br><br>$home"; 

?> 
</body>
</html>

I then have an include file with the Japanese text assigned to the
variable $home.

lng_page_ja.php:
<?php
$home = "&atilde;&#402;&#8250;&atilde;&#402;&frac14;&atilde;&#402;"; 

?> 


Jean-Christian Imbeault wrote:

> Dennis Browne wrote:
> >
> > $home = "$B%[!<(B?";

> That didn't come out right in the email. Are you sure you saved your
> file in UTF-8 format?

> > Why?

> Is your browser detecting that the page is in UTF-8? Manually set you
> browser's page encoding to UTF-8 and see if that makes a difference?

> What browser are you using?

> Jean-Christian Imbeault



--- End Message ---
--- Begin Message ---
I think the first respondant, Mr. Imbeault, is right:  The characters were garbled in 
(Bmy
(Bemail too.
(B
(BI took the HTML portion of your code and opened it in my browser: the text was 
(Bgarbled.  
(B
(BI checked my browser's encoding and it was still set to Shift-JIS(I'm in Japan): 
(Bit didn't switch to UTF-8 in accordance with your meta tag.  But when I manually 
(Bswitched the
(Bbrowser, the text displayed almost perfectly: the characters were a bit messed up(I'm 
(Bgetting: 
(B[ $BecVe!&ec(B ] which converts to [ $B%[$%%`(B ] in Shift-JIS instead of [ 
$B%[!<%`(B ] like is should be).
(B
(BIn any case, it was only after re-saving the file manually with UTF-8 encoding(the 
(B'Dana Text 
(BEditor' makes this easy, http://www.rimarts.co.jp/dana.htm), that my browser was made 
(Bto switch
(Bto UTF-8 upon opening the file, see: http://saba.mitsue.co.jp/~m-grant/UTF8.html. Does 
(Bthe last 
(Bline display correctly for you?
(B
(BAlso, what editor did you use to edit/save these files? If this is a
(Bpersistent problem, then maybe there's an option that's not set(either
(Bin your PHP.ini or your editor) or something of the sort.  Otherwise you
(Bmay want to re-evaluate your workflow and see if there's something you're
(Bmissing.
(B
(BFinally, I noticed that you're posting through the Boeing proxy server (St.Louis?),
(BI used to work for Boeing at the "CSRC" in Bellevue, WA, GREAT people!
(B
(B"Go Big B!"
(B-- 
(BMichael Grant <[EMAIL PROTECTED]>

--- End Message ---
--- Begin Message ---
Is there some mean to know exactly where the domain.mo file will be search for ?
I mean, for a locale accepting aliases, where will the .mo file be searched,
and in which order ? I couldn't find this precisely in PHP manual (user comments),
and my translations don't work all the time (not for all languages at least)
(I know, I must restart apache to avoid using the gettext cache)


Ex on a typical Linux server, for french, locales accepted by setlocale PHP call are
"french", "fr_BE", "fr_FR", "fr_BE.ISO_8859-1", "fr_BE.ISO-8859-1", but not "fr"
(depending on loale.alias of course)
On a Win2000 server, it rather looks like this:
"french", "French", "French_Belgium.1252", "fr" but not "fr_BE", "fr_FR"
The only common one seems to be "french" on both platforms.
As I wanted to maintain only one .po file by language, I choosed "french" as locale name
and as directory for mo file (./locale/french/LC_MESSAGES/domain.mo),
for both platforms, and it finally worked.


Assuming my domain in bound to "./locale" and domain is "messages",
the .mo file will be search in ./locale/xxx/LC_MESSAGES/messages.mo
but what are the xxx ?
Ex for locale "french", xxx=french give expected results, not always xxx=fr.
for "fr_FR", it seems to search for xxx=fr_FR and then xxx=fr.
Ex for locale "dutch", xxx=nl_NL works on Linux, but xxx=dutch won't translate messages...
What's the most correct/robust way to setup these directories ?


Besides this, for french example, I simply used
   setlocale(LC_ALL,'french') and everything was ok, on Linux
But  with Win2000 as server, I had to use
   putenv("LANG=fr"); setlocale(LC_ALL,'french').
This worked for french, but not for dutch anymore.
Perhaps I should set up some other obscure env vars ?
And setlocale(LC_ALL,'') seems to give detailed results on linux only
when I first use 'putenv(LC_MESSAGES,"fr_FR")'.
I feel I'll become mad very soon...

Could someone tell me exactly how it works (preferably on both platforms),
or give me pointers to precise docs so I could stop loosing all my hair ?
(I already read gettext GNU manual but it doesn't really help that much)

Thanks in advance.

Christophe,
http://www.publicityweb.com



--- End Message ---
--- Begin Message ---
We have an internal document storage system that was developed over 6 months ago that 
uses PHP (4.2.0) on a Unix server with Apache to access a PostgreSQL database, with 
IE5.5 as the designated user browser. The system is used to store documents like .jpg, 
.doc, .html, .pdf, .xls etc, allowing users to search for relevant documents, 
downloading/viewing those documents they are interested in. This system has worked 
with no problems until 6-7 weeks ago when our administrators applied the Microsoft 
security patch Q323759 (MS02-047). Now IE5.5 and IE6 are unable to retrieve any 
documents that require another program to be opened for viewing, like PDFs and Word 
documents. On trying to access these documents the user is prompted to either Open or 
Save the document (an unwanted proecss, we want to just open every time where 
possible). Regardless of the option then chosen the following error is given:

Internet Explorer cannot download 'filename' from 'server'.
Internet Explorer was not able to open this Internet site. The required site is either 
unavailable or cannot be found. Please try again later.

Please note that the 'filename' is being exhibited as the address to the page 
executing the download code (show_ind_doc.php?theid=185), and 'server' is the 
appropriate server name.

Images like GIFs and JPEGs, and HTML documents still open OK as they are 'viewable' 
within IE, it's just those that require another program that don't work. This code 
still works in other browsers, like Netscape and Opera. The code is below, any 
assistance with configuring the 'header' sections would be appreciated, the other use 
contributed notes on the header section of php.net have not been able to help me at 
this time.

<?php

function do_con() {

global $connection; 

$host = "server";
$user = "username";
$pass = "password";
$db = "sedocs";
$port = "5432";

$connection = pg_connect ("host=$host port=$port user=$user dbname=$db");

if (!$connection)
{
        die("Could not open connection to database server");
}

}

do_con();

$id = $HTTP_GET_VARS["theid"];

$result = pg_Exec($connection, "select * from sedocs where id = ".$id);
$row = pg_fetch_row($result, 0);
$num_rows = pg_num_rows($result);

$id = $row[3];
$length = $row[6];
$filename = $row[7];
$doctype = $row[5];

header('Content-Type: '.$doctype);
header('Content-Length: '.$length);
header('Content-Disposition: inline; filename="'.$filename.'"');

pg_exec ($connection, "begin");

$handle=pg_lo_open($connection, $id,"r");
$buffer=pg_lo_read($handle, $length );

pg_lo_close($handle);
pg_exec ($connection, "end");
pg_close();


echo($buffer);
?>

Thanks very much

Rob


Robin Ellis
Information & Knowledge
Department of Natural Resources and Mines
PO Box 1167
Bundaberg QLD 4670
ph +61 7 4131 5771
fax +61 7 4131 5823
[EMAIL PROTECTED]




************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
************************************************************************


--- End Message ---

Reply via email to