【发布时间】:2015-07-13 22:26:03
【问题描述】:
我正在使用 Twitter API 使用“statuses/user_timeline”函数来抓取我时间线的最后 3 条推文。它抓取推文并发送响应,但我需要在我的网页中为 HTML 注入超链接。问题是 Microsoft 字符正在丢弃链接位置的索引。
Join us at TOMORROW at @SugarLandtxgov's “Art In The Park” and see the 4
#PODA2 containers all in one place! http://t.co/leqtqhdAiI #HOUarts
[text] => Join us at TOMORROW at @SugarLandtxgov's “Art In The Park” and
see the 4 #PODA2 containers all in one place! http://t.co/leqtqhdAiI
#HOUarts
[url] => http://t.co/leqtqhdAiI
[expanded_url] => http://www.artshound.com/event/detail/441912984
[display_url] => artshound.com/event/detail/4…
[indices] => Array
(
[0] => 109
[1] => 131
)
这是我将超链接注入字符串后的输出:
Join us at TOMORROW at @SugarLandtxgov's “Art In The Park” and see the 4
#PODA2 containers all in one pla<a href="http://t.co/leqtqhdAiI"
target="_blank">ce! http://t.co/leqtqh</a>dAiI #HOUarts
【问题讨论】:
-
我的第一印象是,它可能是多字节字符的计数错误(即 UTF-16 而不是 UTF-8),但链接 href 匹配正确,所以可能不是?你能告诉我们你的代码吗?