Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It's FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Chinese Hyperlink

This is a discussion on Chinese Hyperlink, within the HTML/XHTML section. This forum and the thread "Chinese Hyperlink" are both part of the Designing Your Website category.

 
Reply to this topicStart new topic
> Chinese Hyperlink
Monie
post Jan 1 2009, 07:15 PM
Post #1


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

I have somehow a Chinese hyperlink in my page linked to an excel file somewhere in the server.
But the problem is the link doesn't work!
When I see at the status bar when I hover to the link, the Chinese character become a bunch of number and I think that is why the link to the excel file is not working?
Tested in IE7, the link is completely empty.

Can this be solved using some kind of character encoding?
I heard about this big5 encoding but don't know how to apply them!
Can someone help me biggrin.gif

Cheers...

This post has been edited by Monie: Jan 1 2009, 07:40 PM


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
unitedcraig
post Jan 2 2009, 04:44 AM
Post #2


Squeeze Machine
Group Icon

Posts: 756
Joined: 14-February 08
From: Stockport

could you give us a link to your site mate?


--------------------
.htaccess Tutorial
Your number one resource for anything .htaccess

Go to the top of the page
 
+Quote Post
Monie
post Jan 2 2009, 04:51 AM
Post #3


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

The site that I am developing can be accessed locally inside the company only.
It's actually a link to an excel file (Asset Purchase Requisition Form 资产申购表.xls), as you can see the file name consist of chinese character.
The link work if I change the file name throwing the chinese character, but it doesn't work if the chinese character is there!

Any reason for this?
I've been chased 3 time today from my boss for this biggrin.gif
Cheers...


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
Rakuli
post Jan 2 2009, 10:57 AM
Post #4


Squeeze Machine
Group Icon

Posts: 983
Joined: 13-February 08
From: Catching the squeezed drips downunder.

As far as I was aware, http:// url's can only contain ascii characters. You might want to check for the URL character codes for them and use those in the page.


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
Monie
post Jan 2 2009, 08:03 PM
Post #5


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

The thing is this page that I am developing is similar to directory browsing, which means all the link is directly from the folder inside the server.
That means I cannot change the link that you are suggesting earlier sad.gif
The script I took and modified from this page


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
djeyewater
post Jan 3 2009, 03:13 PM
Post #6


Rapid Squeezer
****

Posts: 184
Joined: 18-February 08

For me, the plain link with chinese chars in the url works fine. Have you tried url encoding the chinese chars e.g.
CODE
<span class="attribute-value">Asset%20Purchase%20Requisition%20Form%20%E8%B5%84%E4%BA%A7%E7%94%B3%E8%B4%AD%E8%A1%A8.xls</span>


Dave
Go to the top of the page
 
+Quote Post
Monie
post Jan 6 2009, 09:06 PM
Post #7


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

I can do just that and it work... But the problem is I can't do that!
I can not change the file name of that link or change any of it! What I can do is just display whatever file in the server to this page!
That means if the file name is abcdef.xls, the link to the file will be abcdef.xls too!

I have tried URL Encode but it didnt work!!!
Please help me guys biggrin.gif


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
japh
post Jan 6 2009, 09:14 PM
Post #8


Squeeze Machine
Group Icon

Posts: 686
Joined: 7-October 08
From: Australia

Have you tried htmlspecialchars()? That might work...


--------------------
Go to the top of the page
 
+Quote Post
Monie
post Jan 7 2009, 04:21 AM
Post #9


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

Wasn't that a PHP function? I am writing in Classic ASP...
I tried with Server.HTMLencode() but it is not working as well...

This post has been edited by Monie: Jan 7 2009, 04:43 AM


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
djeyewater
post Jan 8 2009, 04:21 PM
Post #10


Rapid Squeezer
****

Posts: 184
Joined: 18-February 08

QUOTE (Monie @ Jan 7 2009, 02:06 AM) *
I have tried URL Encode but it didnt work!!!
Please help me guys biggrin.gif


Unfortunately I don't know asp, but if you URL encode the link, what does it give it you?
Using php htmlspecialchars() and htmlentities() didn't work when I tested.
Go to the top of the page
 
+Quote Post
Monie
post Jan 8 2009, 10:27 PM
Post #11


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

It give me "HTTP 404 - File not found" error message!
How come this problem has no solution!
This thing like this is making me pissed off!!!

Can anyone try to create a link to an excel file that have a chinese character inside that file name and see if the link is ok???
If it is ok for all of you, that means this thing have a solution, but if you have the same problem, then what would be the golden solution?

Anyway, thanks djeyewater for doing some testing for me...
I did the test buy no luck I guess!

This post has been edited by Monie: Jan 8 2009, 10:30 PM


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
djeyewater
post Jan 9 2009, 12:02 PM
Post #12


Rapid Squeezer
****

Posts: 184
Joined: 18-February 08

QUOTE (Monie @ Jan 9 2009, 03:27 AM) *
It give me "HTTP 404 - File not found" error message!


But what does the actual link look like? If you can post what the link to the file looks like (view source in the generated html page) then it will help diagnose what asp is doing to the filename that breaks the link.
e.g. The links generated by my PHP test look like this:
CODE
Plain link: <a href="Asset Purchase Requisition Form 资产申购表.xls">Asset Purchase Requisition Form 资产申购表.xls</a><br>
htmlentities: <a href="Asset Purchase Requisition Form &egrave;&micro;�&auml;&ordm;&sect;&ccedil;�&sup3;&egrave;&acute;&shy;&egrave;&iexcl;&uml;.xls">Asset Purchase Requisition Form &egrave;&micro;�&auml;&ordm;&sect;&ccedil;�&sup3;&egrave;&acute;&shy;&egrave;&iexcl;&uml;.xls</a><br>
htmlspecialchars: <a href="Asset Purchase Requisition Form 资产申购表.xls">Asset Purchase Requisition Form 资产申购表.xls</a><br>
urlencode: <a href="Asset+Purchase+Requisition+Form+%E8%B5%84%E4%BA%A7%E7%94%B3%E8%B4%AD%E8%A1%A8.xls">Asset Purchase Requisition Form 资产申购表.xls</a><br>
urlencode (only chinese chars urlencoded): <a href="Asset%20Purchase%20Requisition%20Form%20%E8%B5%84%E4%BA%A7%E7%94%B3%E8%B4%AD%E8%A1%A8.xls">Asset Purchase Requisition Form 资产申购表.xls</a>
Go to the top of the page
 
+Quote Post
Monie
post Jan 9 2009, 11:14 PM
Post #13


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

Its actually a complete directory browsing script that I've downloaded and modified!

The ASP code that produce the link is this:
<% Response.Write "<a class='browse' href=" & ImgDirectory & "/" & escape(DisplayName) & "/" & escape(strFileName) & ">" & strFileName & "</a>" %>

Which produce this HTML code:
<a class='browse' href=ISO-Library/Manufacturing/Xuyi%20Wantotik%20Bestsil%20Mining%20Industries%20Co.%20Ltd/WBM%20-%20PROCUREMENT/Form/Asset%20Purchase%20Requisition%20Form%20资产申购表.xls>Asset Purchase Requisition Form 资产申购表.xls</a>

How the hell should I put "资产申购表" inside the href link to produce a nice clean link like this:
<a class='browse' href=ISO-Library/Manufacturing/Xuyi%20Wantotik%20Bestsil%20Mining%20Industries%20Co.%20Ltd/WBM%20-%20PROCUREMENT/Form/Asset%20Purchase%20Requisition%20Form%20%资产申购表.xls>Asset Purchase Requisition Form 资产申购表.xls</a>

or how should I make the link work eventually! I am tired sad.gif

This post has been edited by Monie: Jan 9 2009, 11:20 PM


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
djeyewater
post Jan 13 2009, 04:43 PM
Post #14


Rapid Squeezer
****

Posts: 184
Joined: 18-February 08

QUOTE (Monie @ Jan 10 2009, 04:14 AM) *
The ASP code that produce the link is this:
<% Response.Write "<a class='browse' href=" & ImgDirectory & "/" & escape(DisplayName) & "/" & escape(strFileName) & ">" & strFileName & "</a>" %>

Which produce this HTML code:
<a class='browse' href=ISO-Library/Manufacturing/Xuyi%20Wantotik%20Bestsil%20Mining%20Industries%20Co.%20Ltd/WBM%20-%20PROCUREMENT/Form/Asset%20Purchase%20Requisition%20Form%20资产申购表.xls>Asset Purchase Requisition Form 资产申购表.xls</a>


Okay, I tried the link that asp is producing and it works fine for me, so I don't know what could be causing the link not to work I'm afraid. I did note that you don't have quote marks around the url, but it worked fine for me anyway without the quote marks. Maybe try Server.URLEncode() instead of escape() and see what the URL looks like that it produces.

Dave
Go to the top of the page
 
+Quote Post
Monie
post Jan 14 2009, 02:46 AM
Post #15


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

I am really very much confused about this!!!
I have uploaded the system (ASP) in the company server and guess what??? All of the link is working fine!
What makes me confused is why it is not working in my PC?

Any third party application or maybe there is some default window setting that need to be activated (ticked) in order for the Chinese character being understood by the system (IIS)?
I still need to make this script run fine in my own PC.
Thanks...


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
djeyewater
post Jan 14 2009, 07:09 AM
Post #16


Rapid Squeezer
****

Posts: 184
Joined: 18-February 08

QUOTE (Monie @ Jan 14 2009, 07:46 AM) *
Any third party application or maybe there is some default window setting that need to be activated (ticked) in order for the Chinese character being understood by the system (IIS)?
I still need to make this script run fine in my own PC.
Thanks...


I think probably you'll need to post your question to an IIS/asp forum to get an answer. I did a quick google search, and it came up with an article on IIS 6.0 Security, but it says ANSI, DBCS and UTF-8 encoded URLs should be accepted by default:
QUOTE (Rohyt Belani, Michael Muckin @ Mar 5 2004)
In order to impede the exploitation of a potential buffer or memory overflow vulnerability that may arise at a later point in time, Microsoft has resorted to the defense-in-depth principle of security in the design of IIS 6.0. This has been accomplished by adding specific URL parsing capabilities to the repertoire of features incorporated in HTTP.sys. These capabilities can be further fine-tuned by appropriately modifying specific registry values. The following table provides a brief overview of vital registry keys (found at the following path: HKLM\System\CurrentControlSet\Services\HTTP\Parameters):

EnableNonUTF8 - The value of this key controls the character set that is permitted by HTTP.sys. The default value of 1 permits HTTP.sys to accept ANSI- and DBCS-encoded URLs in addition to those encoded in the UTF8 format.


This post has been edited by djeyewater: Jan 14 2009, 07:10 AM
Go to the top of the page
 
+Quote Post
Monie
post Jan 17 2009, 08:37 PM
Post #17


Squeeze Machine
*****

Posts: 896
Joined: 13-February 08
From: Borneo

Thanks for the tips mate smile.gif
Appreciated it!


--------------------
Monieweb.com - So much to learn, so little time!
Go to the top of the page
 
+Quote Post
aaron1988
post Jun 10 2009, 05:25 PM
Post #18


Rapid Squeezer
****

Posts: 135
Joined: 17-January 09
From: Gillingham - Kent

on your pc/server do you have chinese language installed cause windows "english" might not recognise it locally if that makes sense not very good at ASP just thought would try to help

Thanks
Aaron
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: