Skip to main content
Inspiring
November 19, 2006
Question

Quotes and validation

  • November 19, 2006
  • 8 replies
  • 462 views
In articles stored in a database text fields there are German quotes,
„e.g.“. I use the alt+132 and alt+147 combinations to put them into the
text. Unfortunately, these entities do not pass the w3-validation.

Is there a way to use these quotes and pass the validation?

Thank you.

Martin
This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Inspiring
November 20, 2006
.oO(David Powers)

>Michael Fesser wrote:
>> .oO(Martin Lang)
>>
>>> In articles stored in a database text fields there are German quotes,
>>> „e.g.“. I use the alt+132 and alt+147 combinations to put them into the
>>> text. Unfortunately, these entities do not pass the w3-validation.
>>
>> What's the error message?
>
>Entities between 130 and 159 inclusive use Microsoft non-standard encoding.

Ah, OK. The Windows-1252 encoding ...

Micha
Inspiring
November 20, 2006
Michael Fesser wrote:
> What's the error message?

Error Line 91 column 198: non SGML character number 132.

You have used an illegal character in your text. HTML uses the standard
UNICODE Consortium character repertoire, and it leaves undefined (among
others) 65 character codes (0 to 31 inclusive and 127 to 159 inclusive)
that are sometimes used for typographical quote marks and similar in
proprietary character sets.

Martin
Inspiring
November 20, 2006
Michael Fesser wrote:
> You don't have to use htmlentities(), just a proper encoding. Umlauts
> are perfectly fine, even with ISO-8859-1. Today there's little to no
> reason to use character references anymore, except for the special chars
> which are handled by htmlspecialchars().

Thank you for the hint!

Martin
Inspiring
November 20, 2006
Michael Fesser wrote:
> .oO(Martin Lang)
>
>> In articles stored in a database text fields there are German quotes,
>> „e.g.“. I use the alt+132 and alt+147 combinations to put them into the
>> text. Unfortunately, these entities do not pass the w3-validation.
>
> What's the error message?

Entities between 130 and 159 inclusive use Microsoft non-standard encoding.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Inspiring
November 20, 2006
.oO(Martin Lang)

>David Powers wrote:
>> „Yes“
>
>Yes, that works and passes, thank you!
>
>Otherwise, if I use htmlentities, it doesn't work. And I have to use it
>because of the German umlauts.

You don't have to use htmlentities(), just a proper encoding. Umlauts
are perfectly fine, even with ISO-8859-1. Today there's little to no
reason to use character references anymore, except for the special chars
which are handled by htmlspecialchars().

Micha
Inspiring
November 20, 2006
David Powers wrote:
> „Yes“

Yes, that works and passes, thank you!

Otherwise, if I use htmlentities, it doesn't work. And I have to use it
because of the German umlauts.
Furthermore, the user who inserts an article can "style" some words or
phrases with ... for instance. So I use regular expressions and
apply them with echo htmreplace(htmlentities(Text)). I've changed one of
the expressions to the quotes and came to:

$msg = preg_replace("/\[q\](.*?)\[\/q\]/si", "„\\1“", $msg);

That seems to work and passes. But I don't know whether that expression
is a correct one. Is it?

Martin

Inspiring
November 20, 2006
.oO(Martin Lang)

>In articles stored in a database text fields there are German quotes,
>„e.g.“. I use the alt+132 and alt+147 combinations to put them into the
>text. Unfortunately, these entities do not pass the w3-validation.

What's the error message?

>Is there a way to use these quotes and pass the validation?

A proper encoding (UTF-8 for example). I use such chars all the time
without any problems.

Micha
Inspiring
November 20, 2006
Martin Lang wrote:
> Is there a way to use these quotes and pass the validation?

„Yes“

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/