Why appear " ? " ?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
[Apache 2, Php 5, MySQL 5, myODBC via ADOdb]

On window works all correctly.

On linux (RedHat) in some pages appear a " ? " char on video.
In HTML source this char IS NOT PRESENT :(.

Some ideas?
That's a problem of charset?

Re: Why appear " ? " ?

Bondo wrote:
Quoted text here. Click to load it

Yes. It might be something simple like "", but it's also possible that  
someone copy and pasted the contents of a Word document containing control  
characters into the database.

In the first case, you can do something as the following to translate these  
characters to their appropriate HTML entity:

$trans = get_html_translation_table(HTML_ENTITIES);
$encoded = strtr(STRING_FROM_DATABASE, $trans);

When producing XHTML, you could also set the encoding to UTF-8 or any other  
appropriate encoding, e.g. with:

<?xml version="1.0" encoding="utf-8"?>

Most browsers enable you to set the encoding manually, which enables you to  
figure out the correct value.

In the second case, you could remove all characters outside the US-ASCII  
character range, e.g. with:

function filter($c) {
    return ord($c[0]) <= 126 ? $c[0] : '';

$filtered = preg_replace_callback('/./s', 'filter', STRING_FROM_DATABASE);

Also, lookup character encoding/decoding in the MySQL manual @  


Site Timeline