472,992 Members | 3,687 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Showing text weirdly with php

Hello,

i have html form for the user to input some french text. The text go in a mysql
database

* before: (mozilla-1.5)

All my pages were designed to show themselves with the iso-8859-15 charset
(accept attribute in forms, and Content-Type in html head).

The from-mysql-showed-text was full of '?' ('&#65533') instead of '-' and "'".

But when i switched Mozilla->View->Coding->iso-8859-1, the '?' were replaced by
the good '-' and "'".

Moreover, phpMyAdmin was showing texts correctly without touching View->Coding.

So i changed everything to use iso-8859-1 (form accept and Content-Type)

* Now:

Still the same for my pages.

phpMyAdmin shows '&#65533' directly in the navigator (no need to open the html
source code)

System:
* Mac OS X 10.2.8
* apache-1.3.28 (home-compiled)
* php-4.3.3 (home-compiled)
* mysql-4.1.0-alpha-standard (package)

Can somebody help me?

Thx

--
TheDD

Jul 17 '05 #1
3 2952
david wrote:
All my pages were designed to show themselves with the iso-8859-15 charset
(accept attribute in forms, and Content-Type in html head).
The accept attribute takes a comma separated list of content
types. In W3C lingo, "content type" is synonymous with MIME type
or media type; text/plain is an example of a MIME type.

Peradventure, you meant to write "accept-charset attribute": a
space and/or comma separated list of "charsets" (character
encodings). ISO-8859-15 is an example of a charset. Anyway,
browser support for accept-charset is pathetic, I believe.

http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.3
The from-mysql-showed-text was full of '?' ('&#65533') instead of '-' and "'".

But when i switched Mozilla->View->Coding->iso-8859-1, the '?' were replaced by
the good '-' and "'".


Sounds awfully like you're not advertising the character encoding
properly -- got a URL?

Forget about that meta hack. What you should be doing is sending
the charset parameter with a bona fide Content-Type header. So if
your document is sent in Latin-9 encoded text, you should ensure
that your server is outputting:

Content-Type: text/html; charset=ISO-8859-15

This is plain sailing in your server, Apache; or you could use
PHP's header function to override the server-set Content-Type
field value.

--
Jock
Jul 17 '05 #2
John Dunlop wrote:
david wrote:
All my pages were designed to show themselves with the iso-8859-15 charset
(accept attribute in forms, and Content-Type in html head).

The accept attribute takes a comma separated list of content
types. In W3C lingo, "content type" is synonymous with MIME type
or media type; text/plain is an example of a MIME type.

Peradventure, you meant to write "accept-charset attribute": a
space and/or comma separated list of "charsets" (character
encodings). ISO-8859-15 is an example of a charset. Anyway,
browser support for accept-charset is pathetic, I believe.

http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.3


yes, my mistake

The from-mysql-showed-text was full of '?' ('&#65533') instead of '-' and "'".

But when i switched Mozilla->View->Coding->iso-8859-1, the '?' were replaced by
the good '-' and "'".

Sounds awfully like you're not advertising the character encoding
properly -- got a URL?
an URL? i'm developping the web site internally, i can't make it public now.

but i've forgotten one thing:
* the texte i put in the textarea is copied from the original (static html)
website. If i replace all the wrong letter, by the same one, typed from
keyboard (instead of copied), it works...

Forget about that meta hack. What you should be doing is sending
the charset parameter with a bona fide Content-Type header. So if
your document is sent in Latin-9 encoded text, you should ensure
that your server is outputting:

Content-Type: text/html; charset=ISO-8859-15

This is plain sailing in your server, Apache; or you could use
PHP's header function to override the server-set Content-Type
field value.


Well i had added the following directive in httpd.conf:
AddDefaultCharset iso-8859-15

wich leads to: (Mozilla request and apache 1.3.28 answer)

GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5)
Gecko/20031007
Accept: text/xml,application/xml,application/xhtml+xml,text/html;
q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: fr-fr,fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.1 200 OK
Date: Wed, 05 Nov 2003 09:37:29 GMT
Server: Apache/1.3.28 (Darwin) PHP/4.3.3
Content-Location: index.html.fr
Vary: negotiate,accept-language,accept-charset
TCN: choice
Last-Modified: Thu, 18 Oct 2001 04:25:28 GMT
ETag: "5882-5f5-3bce59b8;3e7d7b13"
Accept-Ranges: bytes
Content-Length: 1525
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-15
Content-Language: fr

So i change it to iso-8859-1, and it works (everything i've tested this
morning)!!! Thx you so much! I had completely forgot this directive.
Just a little explanation: i tried to use -15 mainly because of the euro sign;
but in html, there is an "entity" for it, so i'm gonna use -1 since it's seems
better handled (and also because most of web sites are in -1 and since the
translation in textarea wich the specified accept-charset is not done, it's
definitely a better choice - i don't have php-iconv -).

(sorry for my bad english)

--
David

Jul 17 '05 #3
david wrote:
Just a little explanation: i tried to use -15 mainly because of the
euro sign; but in html, there is an "entity" for it,


Yes, but in practice, browser support isn't universal. The EURO
SIGN can be presented using the entity reference €, and the
numeric character references € and &#x20ac. The numeric
character reference € has the most browser support.

You could just use the word "euro". No browser gets that wrong.

--
Jock
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill M. | last post by:
Hello, What's up with this? I've got a <td id="container"> and want to set the text in this cell like .... var container = document.getElementById('container'); container.data = "Data in...
1
by: M. L. C. | last post by:
hello, i never studied javascript (i took a look to a tutorial but i haven't been able to figure how to accomplish what i want), i just need for a piece of code to do this thing: to write a...
1
by: Brent | last post by:
I have several radiobuttonlists that I don't want the text to show for. I have made that so through the datalist item editor. It looks great in designtime but it shows text at runtime. The text...
4
by: james.hunt | last post by:
I am using VB.Net 2003 on a Windows 2000 machine to load directory contents into a ListBox. For some unknown reason the text is not visible, however, if I assign a label to the selected item in...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
8
Markus
by: Markus | last post by:
I'm a new designer and pretty young - 16. I've recently encountered a problem with the paragraph tag inside a div. I have a div within a div (both with id selectors) when i place a paragraph tag...
12
by: Ste | last post by:
Hi there, I've got a website with a list of Frequently Asked Questions, so there's a question and answer in a long list down the page. Can anyone recommend a simple script that would allow me...
2
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in...
2
by: Alexei Prada | last post by:
Hi guys, I'm not really advanced in html or css, and I'm having a problem that is really getting me out of my nerves. So I redesigned my portfolio site with dreamweaver as my main html css editor....
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.