Click to See Complete Forum and Search --> : Special Character Display Problems


illtrax
08-17-2006, 03:17 AM
Working on a menu that is in Turkish. I was doing fine with the unicode untill I wanted to display an un-dotted "i"
I usually write it as Ton Balıkl&%305; with the "i" made with & # 305. But this does not translate onto my next page where the customer confirms the order.

I tried putting the tag
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> and inputing the letters without code. This worked good on the menu, but again, not on the confirm page.

Here is the confirm page code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
<html>
<HEAD>
<title>ACL</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function decodeString() {
valNum = new Array();
valData = new Array();
var string, length, dataCount, orderData, grandTotal;
string = "" + unescape(location.search);
string = string.substring(1,string.length);
length = location.search.length;
orderData = "";
dataCount = 1;
for (var c = 0; c < string.length; c++)
if (string.charAt(c).indexOf("&") != -1) dataCount++;

orderData = "<table width=400>";
orderData += "<tr><td>Description</td><td>Cost</td></tr>";
grandTotal = 0;
for (var i = 0; i < dataCount; i++)
{
valNum[i] = string.substring(0,string.indexOf("="));
string = string.substring(string.indexOf("=")+1,string.length);
if (i == dataCount-1) valData[i] = string;
else valData[i] = string.substring(0,string.indexOf("&"));
ampd = valData[i].indexOf("&");
pipe = valData[i].indexOf("-");
star = valData[i].indexOf("*");
line = valData[i].indexOf("$");
itemnum = string.substring(0,pipe);
itemdsc = string.substring(pipe+1,star);
itemcst = string.substring(star+1,line);
string = string.substring(ampd+1,string.length);

orderData += "<tr>";
orderData += "<input type=hidden name=item" + (i+1) + "dsc value='" + itemdsc + "'>";
orderData += "<input type=hidden name=item" + (i+1) + "cst value='YTL" + itemcst + "'>";
orderData += "<td>" + itemdsc + "</td>";
orderData += "<td>" + itemcst + "</td>";
orderData += "</tr>";
grandTotal += parseFloat(itemcst);
}
orderData += "<tr>";
orderData += "<td align=right>Total</td><td>" + grandTotal.toFixed(2) + "</td>";
orderData += "</tr>";
orderData += "<tr>";
orderData += "<td colspan=2 align=center><input type=submit value='Confirm Order!'> or <a href='javascript:history.go(-1)'>Go Back</a></td>";
orderData += "</tr>";
orderData += "<input type=hidden name=total value='YTL" + grandTotal + ".00'>";
orderData += "</table>";
document.write(orderData);
}

function openThanks() {
window.open("confirm-order-thanks.html"); }
// End -->
</script>
</HEAD>
<body>
<form method=post action="gdform.asp" name="emailform">
<input type=hidden name=subject value="** ACL **">

<center>
<script language="JavaScript">
<!-- Begin
decodeString();
// End -->
</script>
</center>
</form>

</body>
</html>
Good or bad news, any help would be great

Kor
08-17-2006, 04:41 AM
Try using unicodes. In fact hexa unicode escapes:
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Unicode
http://www.hot-tips.co.uk/useful/unicode_converter.HTML

For instance, your character is \u0131 in javascript. So that I presume that you should send it as a query in his unicode value.
%u0131
I am not sure, give it a test.

(You may use escape() / unescape() javascript methods as well)

illtrax
08-17-2006, 10:55 AM
Hey Kor,
No go.
It comes back as "Ton Bal%u0131kl%u0131"
Is there anything different I can try?

illtrax
08-17-2006, 11:25 AM
OK... here is a little more info for you.
The menu is at www.aclsandvic.com/test.com.
This is in html.
Items will display on the next page if they are selected.
The next page, www.aclsandvic.com/confirm-order.html, is where the JavaScript lives.
Other letters that are in unicode are fine except for undotted i.
I tried the JavaScript characters but no go

Here is the code for the first and second page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
<html lang="tur">
<head>
<title></title>
</head>
<body>
<center>
<form name=orderform action="confirm-order.html">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<th width="150" align="center" rowspan="5">
<IMG SRC="Corba_Sm.gif" ALT="Corba"></th>
</tr>
<tr>
<th align="center" colspan="3" bgcolor="#66FF33"><U><FONT SIZE=5>Çorbalar</font></U></th>
</tr>
<tr>
<th width="269" height="33" bgcolor="#66FF66" colspan="2">Ürün</th>
<th width="140" align="center" height="33" bgcolor="#66FF66">Fiyat</th>
</tr>

<tr>
<td bgcolor="#66FF33">
<input type=checkbox name=item1A value="Domates
Çorba*2.00$"></td>
<td bgcolor="#66FF33">Domates
Çorba</td>
<td bgcolor="#66FF33" align="center">2.00 YTL</td>
</tr>

<tr>
<td bgcolor="#66FF66">
<input type=checkbox name=item1A value="Süzme
Mercimek
Çorba*2.00$"></td>
<td bgcolor="#66FF66">Süzme
Mercimek
Çorba</td>
<td bgcolor="#66FF66" align="center">2.00 YTL</td>
</tr>

<tr>
<th width="150" align="center" rowspan="8">
<IMG SRC="Makarna_Sm.gif" ALT="Makarna"></td>
</tr>
<tr>
<th align="center" colspan="3" bgcolor="#FF0033"><U><FONT SIZE=5>Makarnalar</font></U></th>
</tr>

<tr>
<th width="269" height="33" bgcolor="#FF3333" colspan="2">Ürün</th>
<th width="140" align="center" height="33" bgcolor="#FF3333">Fiyat</th>
</tr>

<tr>
<td bgcolor="#FF0033">
<input type=checkbox name=item1A value="Mantar
Soslu*3.00$"></td>
<td bgcolor="#FF0033">Mantar Soslu</td>
<td bgcolor="#FF0033" align="center">3.00 YTL</td>
</tr>

<tr>
<td bgcolor="#FF3333">
<input type=checkbox name=item1A value="Domates
Soslu*2.50$"></td>
<td bgcolor="#FF3333">Domates Soslu</td>
<td bgcolor="#FF3333" align="center">2.50 YTL</td>
</tr>

<tr>
<td bgcolor="#FF0033">
<input type=checkbox name=item1A value="Bayaz
Peynirli*2.75$"></td>
<td bgcolor="#FF0033">Bayaz Peynirli</td>
<td bgcolor="#FF0033" align="center">3.00 YTL</td>
</tr>

<tr>
<td bgcolor="#FF3333">
<input type=checkbox name=item1A value="Ton
Bal?kl?*2.75$"></td>
<td bgcolor="#FF3333">Ton
Bal?kl?</td>
<td bgcolor="#FF3333" align="center">2.75 YTL</td>
</tr>

<tr>
<td colspan=4 align=center>
<input type=submit value="Order">
</td>
</tr>
</table>
</form>

</center>
</body>
</html>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
<html>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>ACL</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

function decodeString() {
valNum = new Array();
valData = new Array();
var string, length, dataCount, orderData, grandTotal;
string = "" + unescape(location.search);
string = string.substring(1,string.length);
length = location.search.length;
orderData = "";
dataCount = 1;
for (var c = 0; c < string.length; c++)
if (string.charAt(c).indexOf("&") != -1) dataCount++;

orderData = "<table width=400>";
orderData += "<tr><td>Description</td><td>Cost</td></tr>";
grandTotal = 0;
for (var i = 0; i < dataCount; i++)
{
valNum[i] = string.substring(0,string.indexOf("="));
string = string.substring(string.indexOf("=")+1,string.length);
if (i == dataCount-1) valData[i] = string;
else valData[i] = string.substring(0,string.indexOf("&"));
ampd = valData[i].indexOf("&");
pipe = valData[i].indexOf("-");
star = valData[i].indexOf("*");
line = valData[i].indexOf("$");
itemnum = string.substring(0,pipe);
itemdsc = string.substring(pipe+1,star);
itemcst = string.substring(star+1,line);
string = string.substring(ampd+1,string.length);

orderData += "<tr>";
orderData += "<input type=hidden name=item" + (i+1) + "dsc value='" + itemdsc + "'>";
orderData += "<input type=hidden name=item" + (i+1) + "cst value='YTL" + itemcst + "'>";
orderData += "<td>" + itemdsc + "</td>";
orderData += "<td>" + itemcst + "</td>";
orderData += "</tr>";
grandTotal += parseFloat(itemcst);
}
orderData += "<tr>";
orderData += "<td align=right>Total</td><td>" + grandTotal.toFixed(2) + "</td>";
orderData += "</tr>";
orderData += "<tr>";
orderData += "<td colspan=2 align=center><input type=submit value='Confirm Order!'> or <a href='javascript:history.go(-1)'>Go Back</a></td>";
orderData += "</tr>";
orderData += "<input type=hidden name=total value='YTL" + grandTotal + ".00'>";
orderData += "</table>";
document.write(orderData);
}

function openThanks() {
window.open("confirm-order-thanks.html");
}
// End -->
</script>
</HEAD>
<body>
<form method=post action="gdform.asp" name="emailform">
<input type=hidden name=subject value="** ACL **">

<center>
<script language="JavaScript">
<!-- Begin
decodeString();
// End -->
</script>
</center>
</form>

</body>
</html>

Juuitchan
08-17-2006, 07:32 PM
Why aren't you using server-side for this?!

Don't you know that you should use JavaScript pretty much only when forced to?

illtrax
08-18-2006, 02:03 AM
Why aren't you using server-side for this?!

Don't you know that you should use JavaScript pretty much only when forced to?

1-I have never used server-side and I don't even know what it is.

2-No, I did not know this. I am still learning.

I am a film editor not a web designer. Just trying to help my mother with her cafe's website.

If you have some constructive help to offer, great; but I fail to see how your comment is going to help me. So why post?

Kor
08-18-2006, 02:13 AM
easy, illtrax, Juuitchan really tried to help you, by pointing out that this kind of job is usually done at a server level, by a server-side application, by the normal submit.

illtrax
08-18-2006, 02:54 AM
Sorry about that... misunderstood.
Could you point me in the right direction.
Where do I start?
Do I need a program for my computer or server?
I use Apple so, that may change things as well.
Any help would be great. I have posted on a few forum sites. Nobody knows.
Sorry Juuitchan, just getting frustrated.

Juuitchan
08-18-2006, 04:05 AM
Try looking into PHP.

Kor
08-18-2006, 06:44 AM
Probably ASP (I saw that the action is towards an asp file. Shall I move this tread into the ASP Forum, illtrax? You might find there some advice.

illtrax
08-18-2006, 03:21 PM
That would be good Kor. Thanks for the help guys.

Kor
08-18-2006, 03:36 PM
OK, you're in the ASP area now illtrax. Please, ASP coders, help illtrax to send/interpret the correct special characters to an ASP file