homepage Welcome to WebmasterWorld Guest from 54.167.182.201
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Change character in an include
helenp

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4534937 posted 7:25 am on Jan 10, 2013 (gmt 0)

Hi,
I am implanting fpdf that does not support utf-8.
So on the page where the pdf is created I use iso-8859-1.

The problem is with the 3 includes I have, I use them on the whole site, and one is the menu that is actualized often and I dont want to have special for this page.

So I wondere if there is some possibility to change the utf-8 characters to iso-8859-1 in the includes without having to touch the html inside the includes.
Thanks

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4534937 posted 10:55 am on Jan 10, 2013 (gmt 0)

Option C is to edit your include files-- just the html output, nothing else-- to replace any non-ASCII characters with HTML entities. (And tell the php not to change them back!) I do not like this approach. But it is definitely safe. And it's less complicated than putting in a whole new routine to change the text encoding of the output. I don't know how you would even do that without editing the line that calls the include.

:: thinking ::

Suppose you coded the include files to say "If such-and-such parameter is present, then use it to set the file encoding of the output; otherwise default to UTF-8." The idea is to make the include file do something new without having to change all existing pages to make them pass an additional variable.

Do your include files also read data that's stored as UTF-8? So they would also have to convert any text they work with? You can see where Option C starts looking not too bad ;)

...

Now just watch. Next week your fpdf will come out with a version that does support utf-8.

helenp

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4534937 posted 11:52 am on Jan 10, 2013 (gmt 0)

Yes I use it on utf-8 files, the only iso file is the one for creating the pdf.

Are you the developer of fpdf lol?

swa66

WebmasterWorld Senior Member swa66 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4534937 posted 2:58 pm on Jan 10, 2013 (gmt 0)

I remember reading that fpdf does support UTF-8 ...

[fpdf.org...]

helenp

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4534937 posted 5:11 pm on Jan 10, 2013 (gmt 0)

I remember reading that fpdf does support UTF-8 ...

[fpdf.org...]

Wow, thanks for that, its a modified version,
I read everywhere except there not to use utf-8 :(
I think lucy can read the future lol, it is supported but before next week.

helenp

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4534937 posted 11:18 am on Jan 12, 2013 (gmt 0)

found this that does suppost utf-8 and is very compex, maybe a bit complex and slow, but I do recomend it:
[tcpdf.org...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved