473,405 Members | 2,415 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,405 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 2966
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....
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.