PDA

View Full Version : ajaxtabscontent-text



jass
08-19-2007, 04:21 PM
1) Script Title:
ajaxtabscontent

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm
3) Describe problem: The text used is chinese.
When viewing online, the chinese text content inside the container (fetched from http://domain.com/external.htm) on the demo page become "unrecognizable code".
The chinese text on the TAB is fine.
The chinese text viewed direct from http://domain.com/external.htm is also OK.

jscheuer1
08-19-2007, 07:39 PM
There are no Chinese characters on those linked pages. If you really meant some other page, make sure the server is configured properly. I could try to check if I had the correct link.

jass
08-20-2007, 01:50 AM
Thanks for your kind response, John.

The correct URL should be :

http://julie.cogia.net/demo.htm

http://julie.cogia.net/external.htm

Also I wonder if it is possible to replace the horizontal menu tab with a verticle one on the left of the page?

Many thanks again in advance.

jscheuer1
08-20-2007, 02:56 AM
OK then. I'm still not seeing any Chinese characters in Opera, IE or FF on either page. However, I am seeing the seemingly 'random' characters that I take to be the ones that you would like to be rendered in:

charset=gb2312

or some more appropriate encoding. The simplest solution, which may or may not work, is to use a header/prologue like:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

in place of your current DOCTYPE, opening HTML tag and opening HEAD tag, on both pages. The exact specifications may need to be tailored to your character set, not the one shown above, which is good only for a particular Chinese character set. But, depending upon your server, this may not be enough. The server itself may need to be configured. How this is done varies from server to server and there are different methods even with a given type of server, depending upon your access to that server.

Your host, if they offer any kind of decent help/support would be the best resource for more information on configuring your server in this regard. Google can also yield some information. Try:

http://www.google.com/search?hl=en&lr=&client=opera&rls=en&q=character+sets+server+configuration&btnG=Search

jass
08-20-2007, 04:45 AM
Thank you very much, John.
May I also know if it is possible to replace the horizontal menu tab with a verticle one on the left of the page?

jscheuer1
08-20-2007, 03:44 PM
Not perfect, but this worked out pretty well (use for ajaxtabs.css):


.shadetabs{
padding: 3px 0;
margin-left: 0;
margin-top: 5px;
margin-bottom: 0;
font: bold 12px Verdana;
list-style-type: none;
float:left;
text-align: right; /*set to left, center, or right to align the menu as desired*/
}

.shadetabs li{
display: block;
margin: 0 0 10px 0;
}

.shadetabs li a{
text-decoration: none;
padding: 3px 7px;
margin-right: 3px;
border: 1px solid #778;
position:relative;
z-index:10;
color: #2d2b2b;
background: white url(shade.gif) top left repeat-x;
}

.shadetabs li a:visited{
color: #2d2b2b;
}

.shadetabs li a:hover{
text-decoration: underline;
color: #2d2b2b;
}

.shadetabs li.selected{
position: relative;
left: 2px;
}

.shadetabs li.selected a{ /*selected main tab style */
background-image: url(shadeactive.gif);
border-right-color: white;
cursor:default;
}

.shadetabs li.selected a:hover{ /*selected main tab style */
text-decoration: none;
}

.contentstyle{
border: 1px solid gray;
width: 450px;
margin-bottom: 1em; padding: 10px;
margin-left:-3px;
float:left;
}

Also, on your other problem, I forgot to mention that using the HTML entities for the non-standard characters that you wish to see displayed may work.

jass
08-21-2007, 03:15 AM
I greatly appreciate your kind assistance, John. Thank you so much.

I tried using the following encoding (and had also tried replacing "big5" with "UTF-8") without yielding satisfactory result:

<?xml version="1.0" encoding="big5"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
<title></title>
<meta http-equiv="Content-Language" content="zh" />
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
</head>

I will be writing to the hosting company for support.

jass
08-22-2007, 12:49 AM
Hi John, I have just got a reply from the technician of the hosting company:

AJAX is performed 100&#37; client side, so you would need to ensure you have the proper encoding happening when you are processing AJAX. The encoding process would then be handled by the browser.

I wonder if you or anyone know where the problem lies? Would appreciate if someone could advise.

I reappend the problem as follows:

http://julie.cogia.net/demo.htm
The text used on the HTML page is chinese.


<?xml version="1.0" encoding="big5"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
<title>Chinese Text</title>
<meta http-equiv="Content-Language" content="zh" />
<meta http-equiv="Content-Type" content="text/html; charset=big5" />

When viewing online, the chinese text content inside the container (fetched from http://julie.cogia.net/external.htm) on the demo page become "unrecognizable code".
The chinese text on the TAB of the "demo.htm" is fine.
The chinese text viewed direct from http://julie.cogia.net/external.htm is also OK.

jscheuer1
08-22-2007, 02:43 AM
Well, at least it is working on the page now. It is also now working completely in Opera, so I would say you have the right encoding on your page. Your 'helper' at your host is wrong though. Ajax depends upon the server fetching and sending the content from the external page and upon the server sending it wih the correct encoding. Just as an experiment, I'd try giving the external page an extension of xml. If you do this, you need to change it in the link that calls it as well. I'd also try .txt as an extension. These are just tests. I'll look into using the HTML entities for your characters, but, if you are planning on having entire pages full of these characters, that may not be too practical.

Something to ask your host is if they support and allow the use, by you, of the .htaccess file for your site. This may provide a solution.

jscheuer1
08-22-2007, 03:31 AM
This is the second reply (yet another approach), don't forget to look at my previous response. Anyways, Unicode entities may be used. Here is the character from your bird page:



which produces:



when parsed by the browser, just like:

&copy;

produces:



Here is a pretty decent converter:

http://www.mikezilla.com/exp0012.html

Just paste your characters into the field marked "ASCII Text:", hit encode, and the Unicode entities will be shown in the field marked "Unicode Value:".

Gonegold
08-29-2007, 11:28 PM
I have some problem with cyrillic encoding... How i can fix it? Can i use some js procedure to encrypt all 33 cyrillic letters to Unicode? My hosting company can't solve this problem.

Gonegold
09-14-2007, 08:54 PM
Can anyone help me?