ModalBox encoding problem

I want to use ModalBox ( but I'm having problem displaying the content.

The content of the modalbox is retrieved from a page that is not UTF-8 concoded, so on the page "?" apear.

How can i fix it ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Perhaps use a proxy that can re-encode as UTF8?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pddAuthor Commented:
I don't want to use it as UTF8, I want it to be ISO-8859-1
Michel PlungjanIT ExpertCommented:
So you convert YOUR page to iso-8859-1 and the problem is solved...
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Michel PlungjanIT ExpertCommented:
Or am I missing something...

If your page is iso-8859-1 then you need to change all occurrences of UTF8 in the modal code like here

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

Open in new window

pddAuthor Commented:
The page is with that meta tag.

Let me explain again:
On a page that is  iso-8859-1 i retrive some content using ajax (prototype fw) and then display it on the page.
The content retrieved  is  iso-8859-1 encoded, the page is also like that, but when i put the content on the page it appears with "?".
I even tried to make the encoding of the request to be   iso-8859-1 but that didn't solved the problem
Michel PlungjanIT ExpertCommented:
I understand. The modalbox code is UTF8

Searching for: utf
modalbox1.6.0\lib\prototype.js(1182): encoding:     'UTF-8',
modalbox1.6.0\tests\functional\_ajax_form.html(1): <form action="#" method="get" name="form" id="form" accept-charset="utf-8" onsubmit="'_ajax_form.html', {title: 'Step 2', width: 500}); return false;">
modalbox1.6.0\tests\functional\_ajax_js.html(3): <script type="text/javascript" charset="utf-8">
modalbox1.6.0\tests\functional\func-modalbox-test.html(6): <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
modalbox1.6.0\tests\functional\func-modalbox-test.html(31): <form action="#" method="get" accept-charset="utf-8">
modalbox1.6.0\tests\functional\func-modalbox-test.html(39): <script type="text/javascript" charset="utf-8">
modalbox1.6.0\tests\unit\_ajax_content_js.html(2): <script type="text/javascript" charset="utf-8">
modalbox1.6.0\tests\unit\unit-modalbox-test.html(6): <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
modalbox1.6.0\tests\unit\unit-modalbox-test.html(42): <script type="text/javascript" language="javascript" charset="utf-8">
Found 9 occurrence(s) in 6 file(s)

Open in new window

pddAuthor Commented:
Yes, I changed
modalbox1.6.0\lib\prototype.js(1182): encoding:     'UTF-8',
to iso-8859-1 but that didn't helped.

Do you have any idea how to solve this ?
Michel PlungjanIT ExpertCommented:
No - not if the above did not do it.... But UTF8 is the way to go anyway so I still suggest you convert your data to UTF8
b0lsc0ttIT ManagerCommented:
Keep in mind that to have the page sent as UTF-8 doesn't necessarily mean you need to convert the page itself.  You might be able to have the server do it for you.  Are you using a server language or getting the content from a DB?  If so provide details.  I believe I have seen third-party components you can add to the server and some languages/technologies may be able to do this for you without an addon object.

I don't know if this will help but provide details and let me know if you want more info on this.

pddAuthor Commented:
Hi b0lsc0tt.

The ModalBox get's the content of a page that is generated using PHP.
Yes, I could convert the page to UTF-8, I allready done this on several pages, but I don't want to / can't do it for some other pages.
b0lsc0ttIT ManagerCommented:
Since it is coming from server script anyways all you would have to do, in PHP, is add the line below to the top of the PHP script.

header("Content-type: text/html; charset=utf-8");

Is that what you have tried on other pages but don't want to do here?  Hopefully it is actually something else and more complicated because this is so simple and easy (but should do it) that I can't imagine it wouldn't be something you would do in these pages.

Let me know if you have a question.  Thanks for the details and response you provided.

pddAuthor Commented:
Yes, setting the header is what i've done on some pages, but i actually made the header

header("Content-type: text/html; charset=iso-8859-1");

The problem with other pages is that they are external, so i can not modify the pages or the headers using JS.
In this case the solution would be a proxy, but I can not use a proxy because all functions that get content from outside do not work (disabled by admins).

So another solution would be to use an external proxy, but that only of there is no way to do it with only JS
b0lsc0ttIT ManagerCommented:
Mplungjan could confirm this but I don't know any way for JS to convert the charset used.  An external proxy, what he originally suggested, sounds like what you need to use in this case.

Let us know if you need any more help or have a question.

Michel PlungjanIT ExpertCommented:
I do not know of a way in JS to convert the charset. It may exist but I cannot think of how
pddAuthor Commented:
The only question would be how to make it in JS ?
b0lsc0ttIT ManagerCommented:
Isn't that what we just responded to?  You can't do it in Javascript.  If you are asking something new then please clarify.  Otherwise Javascript doesn't provide a way to change or convert the encoding like you need.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.