Jump to content

problem with charset


jimath

Recommended Posts

hi everyone!

 

i have a problem with charset. i am using php 4.3.4.

in all my scripts i ve declared the line

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 

i put UTF-8 from character encoding in mozzila browser and when i click a link

in my project the letters are changed to sth unintelligible.

 

could anyone help me?

 

 

Link to comment
Share on other sites

The problem is that the HTTP headers that are being sent to the browser are not UTF-8, but the encoding of the text inside the files is UTF-8. This was kind of what I thought. There are a few possible reasons for this, but I suspect that your php encoding is set to something other than UTF-8.

 

First, when you switch the encoding in the 'view' menu in firefox, you switch it to UTF-8 and it becomes visible right?

 

Second, create a new php file, and add this one line of code to it:

 

<?php echo phpinfo(); ?>

 

Then upload that to the folder that you are having troubles with, and open that file through your browser. Then tell me what it says under

 

HTTP Headers Information  =>  Accept-Charset

 

 

Link to comment
Share on other sites

i do not see anything relevant to this (HTTP Headers Information  =>  Accept-Charset)

 

some relevant displayed are:

HTTP_ACCEPT_LANGUAGE  el 

HTTP_ACCEPT_ENCODING  gzip, deflate 

_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate

_ENV["HTTP_ACCEPT_ENCODING"] gzip, deflate

Link to comment
Share on other sites

yes i can.

i opened php.ini and i saw the following:

is anything relevant?

 

 

; http input encoding.

;mbstring.http_input = auto

 

; enable automatic encoding translation accoding to

; mbstring.internal_encoding setting. Input chars are

; converted to internal encoding by setting this to On.

; Note: Do _not_ use automatic encoding translation for

;      portable libs/applications.

;mbstring.encoding_translation = Off

 

; automatic encoding detection order.

; auto means

;mbstring.detect_order = auto

 

; substitute_character used when character cannot be converted

; one from another

;mbstring.substitute_character = none;

Link to comment
Share on other sites

Not if you are using UTF-8. Those are the the multi-byte string library functions, but UTF-8 is a single-byte language.

 

Look for the part of the php.ini that says

 

default_charset = _____________

 

it should read:

 

default_charset = "UTF-8"

 

If it doesn't, then post what it does say.

Link to comment
Share on other sites

OK NOW IT WORKS!!

THANK YOU VERY MUCH HAKU!!!

 

IT was

;default_charset = "iso-8859-1"

and i changed it to:

default_charset = "UTF-8"

 

so i have to change the default_charset in php ini

correspondingly to what charset i am using to my scripts?

or using UTF-8 i am covered?

 

Link to comment
Share on other sites

If utf-8 is what you want to use (it may or may not be, I don't know what the needs or your website are, or what is recommended for working with Greek languages), then everytime something doesn't come out right, look around for something somewhere that isn't in utf-8.

 

So your documents should be encrypted in utf-8, and you should use utf-8 for the internal encoding. You should set emails with ISO-8859-01 (at least for English) though, and I've heard that utf-8 can be unreliable with emails. I dont know though - I program sites in Japanese so I don't use utf-8, I use multibyte character sets which is a whole different game.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.