图像名称的重音

时间:2010-01-14 20:23:48

标签: php javascript

在我的php + javascript项目中,我必须显示图像,其中一些还有重音, 喜欢~ç和^。 我的网站没有显示这些图片。 我知道有一个功能来对待这个,但我忘记了。 有人可以帮帮我吗? 感谢的

2 个答案:

答案 0 :(得分:1)

尝试通过rawurlencode()运行图片网址。

答案 1 :(得分:0)

/*  (C)Scripterlative.com
 *  Strips grave, acute, circumflex umlaut and tilde from vowels and Ñ.
 *
 *  Include this script block, then within the tag of each text element to be controlled, insert:
 *
 *  onblur='this.value=stripVowelAccent(this.value)'
 *
 *  GratuityWare
 *  ~~~~~~~~~~~~
 *  You obtained this script probably out of desperation, so if you wish to express your gratitude for our efforts,
 *  please visit: www.scripterlative.com
 *
 */

function stripVowelAccent(str)
{
 var rExps=[
 {re:/[\xC0-\xC6]/g, ch:'A'},
 {re:/[\xE0-\xE6]/g, ch:'a'},
 {re:/[\xC8-\xCB]/g, ch:'E'},
 {re:/[\xE8-\xEB]/g, ch:'e'},
 {re:/[\xCC-\xCF]/g, ch:'I'},
 {re:/[\xEC-\xEF]/g, ch:'i'},
 {re:/[\xD2-\xD6]/g, ch:'O'},
 {re:/[\xF2-\xF6]/g, ch:'o'},
 {re:/[\xD9-\xDC]/g, ch:'U'},
 {re:/[\xF9-\xFC]/g, ch:'u'},
 {re:/[\xD1]/g, ch:'N'},
 {re:/[\xF1]/g, ch:'n'} ];

 for(var i=0, len=rExps.length; i<len; i++)
  str=str.replace(rExps[i].re, rExps[i].ch);

 return str;
}