Miranda NG Official Community Forum

Forum for English speaking Miranda NG users => Bug reports => Topic started by: omniwolf on 27 07 2015, 01:46:50

Title: Twitter protocol - special characters not displaying properly
Post by: omniwolf on 27 07 2015, 01:46:50
Hi again

Recently i've noticed that the twitter client is not displaying "<" or ">" correctly in the twitter feed.  instead it displays "&lt;" or "&gt;".
This happened previously with the "&" character, and when i was maintaining the protocol i had to "fix" this as you can see here:

https://github.com/miranda-ng/miranda-ng/blob/master/protocols/Twitter/src/twitter.cpp#L243

and here:

https://github.com/miranda-ng/miranda-ng/blob/master/protocols/Twitter/src/twitter.cpp#L252


So you'd have to put somewhere around line 263 (above the push_back(u) call):

Code: [Select]
// ok here i'm trying some way to fix all the "&gt;" and "&lt;" things that are showing up
// i dunno why it's happening, so i'll just find and replace each occurance :/
std::string rawText = u.status.text;
for (size_t pos = 0; (pos = rawText.find("&lt;", pos)) != std::string::npos; pos++)
rawText.replace(pos, 4, "<");

for (size_t pos = 0; (pos = rawText.find("&gt;", pos)) != std::string::npos; pos++)
rawText.replace(pos, 4, ">");

u.status.text = rawText;
Title: Re: Twitter protocol - special characters not displaying properly
Post by: Robyer on 27 07 2015, 09:07:00
Done :-) http://trac.miranda-ng.org/changeset/14734/
Title: Re: Twitter protocol - special characters not displaying properly
Post by: omniwolf on 27 07 2015, 23:58:03
much neater, thank you :)