473,382 Members | 1,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Language settings?

310 100+
This may not be a PHP problem, but at the moment I do not know where the solution is. So assuming it may have to do with PHP, I will post this here. If anyone knows that the solution to this problem should be found elsewhere, please let me know!

I am setting up a new Linux server (Novel Suse 10.1) to run my PHP/MySQL database applications. I am located in Denmark. On my other Linux machines, I can get the special Danish letters å, ø, æ to be correctly displayed on the user's browser simply by echo'ing them to the browser without needing to use any special HTML character coding, for example:

Expand|Select|Wrap|Line Numbers
  1. echo "Danish letters: å, æ, ø<br>";
  2.  
But this does not work on the new SUSE machine, I get strange symbols instead. I do get the correct Danish letters when typing them in a terminal window, and when I put the above echo statement in a PHP script and use the CLI version of php5 to run the script directly from the terminal with output to the terminal. So the Danish alphabet is somehow installed on the SUSE machine. It is just not sent out correctly from PHP scripts when they are run from Apache and the output is sent to a remote browser. Again: these are the very same scripts that run correctly on my other machines.

Does anyone know what I need to do to get the proper language alphabet settings to work? Is this a PHP configuration? Or must I look elsewhere?

Thanks!

Steve, Denmark
May 9 '08 #1
9 2003
Atli
5,058 Expert 4TB
I would guess this has something to do with which charset the browser is being told to use.
What charset are the pages on your other servers using?

What happens if you print the letters in proper HTML markup, specifying the correct charset?
Like:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  4. </head>
  5.  
  6. <body>
  7. <?php echo "Danish letters: å, æ, ø<br>"; ?>
  8. </body>
  9. </html>
  10.  
May 12 '08 #2
coolsti
310 100+
Thanks for the reply.

This is a mystery to me.

I did some more experimenting.

1) Danish letters appear on the user's browser correctly when they are read from the database to a PHP variable and then echo'ed to the user's browser.

2) Danish letters do not appear correctly when they are "hard coded" in the PHP script, for example using a statement like this:

Expand|Select|Wrap|Line Numbers
  1. echo "Danish letters: åøæ<br>";
  2.  
3) Danish letters appear correctly in a shell terminal window, and they appear correctly in the VIM editor which I am using.


I still do not count out the possibility that this is somehow a PHP configuration issue. But it also may be an Operating system configuration issue.

By the way, adding the meta line to the html as Atli suggests did not help.

Can anyone help here?

Thanks!
May 13 '08 #3
hsriat
1,654 Expert 1GB
Apparently there's a problem with the editor you are using.

Replace the Danish characters (hard coded ones) with the respective Unicode. This may help.

Find the Unicode table here.
May 13 '08 #4
coolsti
310 100+
Ok, that helps a bit, if I could find out that it is the editor that is causing the problem.

But is it? Consider this experiment:

I have a Centos 4.5 PC where everything works correctly. I create a PHP script on this machine which prints out some Danish letters as part of an html page in an echo statement. This works correctly on the Centos 4.5 PC.

I then copy this script file (using scp) to the SUSE 10.1 PC. And without ever opening the file with any editor on the SUSE 10.1 PC, I call the script, and the Danish letters appear incorrectly.

I did not use an editor on the SUSE machine for this file, so I cannot have "corrupted" the letters because of the editor. And since the file prints correctly when called from the Centos PC where the file was created, I would assume that the editor on the Centos PC is correct.

So still a mystery to me. It seems like a missing configuration somewhere on the SUSE machine. But maybe not with PHP.
May 13 '08 #5
hsriat
1,654 Expert 1GB
That is weird.

Do one thing, add the php header for encoding type. May be the default settings in your server are not set for UTF-8 but ISO-8859-1.
May 13 '08 #6
coolsti
310 100+
Yes, I did try that but it did not help.

A real mystery :-)
May 13 '08 #7
coolsti
310 100+
Well I did solve the problem by adding the meta tag to the header section. I had tried this yesterday but it did not help then, so I must have introduced a syntax error in my haste. I tried again and it works now.

Still a mystery why this is needed for the one machine and not the other. Maybe an Apache configuration issue. But it does not seem to be related to PHP at all.
May 14 '08 #8
Atli
5,058 Expert 4TB
Still a mystery why this is needed for the one machine and not the other. Maybe an Apache configuration issue. But it does not seem to be related to PHP at all.
Take a look at the AddDefaultCharset Directive.

It attempts to force the given charset on all pages sent as text/plain or text/html.
Maybe this is set on your other servers?

Personally, I would prefer to leave this off and specify it for each page, but thats just me :P
May 14 '08 #9
coolsti
310 100+
Hi Atli,

it would also be just me as well :)

I am adding the meta tag to the PHP scripts that produce my page headers. Fortunately I have programmed everything in a very simple OOP manner (where I have a class that produces the main page structure including header), so there is only one place in one file per application that I need to make this addition :)

But thanks for the tip. May be interesting to dig a bit and see if what you are saying is the case.
May 15 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Gustaf Liljegren | last post by:
In IE (at least from version 5), you can change your prefered language, so that for example the Windows Update page appears in another language than the system default. Here's the process: Tools...
9
by: WizardLee | last post by:
Hi, all, A new feature is required to add to my program today. But I do not have any idea about it. The feature should implement these two functions: 1, Select "Install files for East Asia...
3
by: clintonG | last post by:
I'm messing around with the Request.UserLanguages and the Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see how similar or dissimilar they may be. I observe and conclude that both get...
5
by: Jack | last post by:
Hello, I have a VB.NET application that will be distributed in the US as well as many European countries. It uses an xml database with number values, that are stored as text, that are all in...
1
by: PawelSokolowski | last post by:
Hi all, C++, .NET 2003. I have created an application that I want to distribute in 4 languages. This is static MFC with no DLLs, every language has its own build configuration. I have 4 String...
0
by: Bruna | last post by:
I'm working in vb.net 2005, and in a project we're working, we have a main form and a few other forms with different settings. One of them is User setting form with 3 settings, and one of them is...
2
by: shizah | last post by:
Hello how can I convert my web pages into Arabic in such a manner that the value in the text boxes will be in Arabic rather than English. The thing I know is just the code for Arabic is "ar-sa"...
1
by: Screaming Eagles 101 | last post by:
This is not a question but something I found, it might not be the best solution, but hey, it works... :-) Thought someone else could also use this, so here it is. I made 2 resource files, one...
3
by: plenty900 | last post by:
Hi folks, I've altered the PHP underlying a website to support a few languages other than English, but the Firefox version that I'm using is of course the English-language one. When I set the...
1
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi, My C# program supports different languages using resource files. I need a way to detect the language used in the host computer, then the software can change its own language settings. How...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.