Problem with euro sign (and others)

Problem with euro sign (and others)

am 30.11.2007 20:51:03 von georg116

Hi,

I have a database PostgreSQL entry that includes the string €
which is the euro sign.

When I retrieve the string through a PHP SQL statement and then echo the
result to the browser, it shows the correct euro sign, but in the source
code, it still says € ...

This is a problem to me, because I generate a PDF, and in this it still
says € instead of the euro sign. I have the same behaviour with
signs like '-' and '+'

Any help is very appreciated.

Thanks,georg.

Re: Problem with euro sign (and others)

am 30.11.2007 21:07:17 von lamib

Georg Weiler wrote:
> Hi,
>
> I have a database PostgreSQL entry that includes the string €
> which is the euro sign.
>
> When I retrieve the string through a PHP SQL statement and then echo the
> result to the browser, it shows the correct euro sign, but in the source
> code, it still says € ...
>
> This is a problem to me, because I generate a PDF, and in this it still
> says € instead of the euro sign. I have the same behaviour with
> signs like '-' and '+'
>
> Any help is very appreciated.
>
> Thanks,georg.

You have to simply replace the HTML symbols with the real characters
before generating the PDF with str_replace.

--
www.lamib.info

Re: Problem with euro sign (and others)

am 30.11.2007 21:10:07 von georg116

Thanks lamib, it works.

But isn't there a ready-to-use built-in function in PHP that does this
trick?

lamib schrieb:
> Georg Weiler wrote:
>
>> Hi,
>>
>> I have a database PostgreSQL entry that includes the string €
>> which is the euro sign.
>>
>> When I retrieve the string through a PHP SQL statement and then echo
>> the result to the browser, it shows the correct euro sign, but in the
>> source code, it still says € ...
>>
>> This is a problem to me, because I generate a PDF, and in this it
>> still says € instead of the euro sign. I have the same behaviour
>> with signs like '-' and '+'
>>
>> Any help is very appreciated.
>>
>> Thanks,georg.
>
>
> You have to simply replace the HTML symbols with the real characters
> before generating the PDF with str_replace.
>
> --
> www.lamib.info

Re: Problem with euro sign (and others)

am 30.11.2007 21:20:17 von lamib

Georg Weiler wrote:
> Thanks lamib, it works.
>
> But isn't there a ready-to-use built-in function in PHP that does this
> trick?
>
> lamib schrieb:
>> Georg Weiler wrote:
>>
>>> Hi,
>>>
>>> I have a database PostgreSQL entry that includes the string €
>>> which is the euro sign.
>>>
>>> When I retrieve the string through a PHP SQL statement and then echo
>>> the result to the browser, it shows the correct euro sign, but in the
>>> source code, it still says € ...
>>>
>>> This is a problem to me, because I generate a PDF, and in this it
>>> still says € instead of the euro sign. I have the same
>>> behaviour with signs like '-' and '+'
>>>
>>> Any help is very appreciated.
>>>
>>> Thanks,georg.
>>
>>
>> You have to simply replace the HTML symbols with the real characters
>> before generating the PDF with str_replace.
>>
>> --
>> www.lamib.info

Oh, yeah, sorry, I totally forgot about it. html_entity_decode is what
you're looking for! :)

--
www.lamib.info

Re: Problem with euro sign (and others)

am 01.12.2007 14:17:31 von Jonas Werres

> This is a problem to me, because I generate a PDF, and in this it still
> says € instead of the euro sign. I have the same behaviour with
> signs like '-' and '+'

So you learned that output specific codes never ever belong into the
database.