2015-04-29 33 views
0

這不像其他人修正另一個帖子那樣是一個圖標。將圖標添加到html代碼標題

這是Expedia的網頁源代碼的樣子:

<title data-sctid="title" data-sct-hidden="true"> Atlantic City Hotels: Find 122 Cheap Hotel Deals in Atlantic City, NJ | Expedia</title> 

在谷歌結果頁會顯示該http://goo.gl/YEjujq

我試圖插入

$this->set('title_for_layout', " Atlantic City Hotels: 28 Cheap Hotel Deals AtlanticCity.com"); 

但因爲我不能救得到這個錯誤

西文(ISO拉丁文1)的文本編碼不適用。

回答

0

這是因爲此字符(可能)不是拉丁語1代碼頁的一部分。你應該用Unicode編碼你的頁面(UTF-8是通常使用的),以便它能夠正常工作。

+0

確定..嘗試這個......「☆大西洋城酒店:28便宜酒店優惠AtlanticCity.com「);明星....會看到它是否顯示在谷歌。發現這裏http://en.wikipedia.org/wiki/Miscellaneous_Symbols無法找到好色的像他們一樣 – dave

+0

好的...我找到了源代碼。 http://en.wikipedia.org/wiki/Miscellaneous_Symbols_and_Pictographs – dave

1

正如Tsahi所說,該字符在該特定編碼中無效。

什麼你可以要做的,就是嘗試它的Unicode或HTML字符代碼:

$this->set('title_for_layout', "&#127976; Atlantic City Hotels... 

$this->set('title_for_layout', "\uD83C\uDFE8 Atlantic City Hotels... 
+0

我試過後者,它工作。 '$(「input [name ='q']」)。value =「\ uD83C \ uDFE8 Atlantic City」 – sircapsalot