Commit 289cd7fa1a85c8c43f114c4caa4a6872e38acddd

Authored by Evandro Junior
1 parent d0f151cb
Exists in master

Fixed UTF8 validation for tweets "Attention please, don't remove + ' ')[0..-2] i…

…t is used for UTF8 validation"
tweeter_stream/lib/twurl/request_controller.rb
@@ -20,14 +20,16 @@ module Twurl @@ -20,14 +20,16 @@ module Twurl
20 begin 20 begin
21 parsed = JSON.parse(chunk) 21 parsed = JSON.parse(chunk)
22 ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') 22 ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
23 - comment_text = ic.iconv(parsed["text"])[0..-2] 23 + #Attention please, don't remove + ' ')[0..-2] it is used for UTF8 validation
  24 + comment_text = ic.iconv(parsed["text"] + ' ')[0..-2]
24 print "#{comment_text}\n" 25 print "#{comment_text}\n"
25 comment = Comment.new 26 comment = Comment.new
26 comment.title = 'hub-message-twitter' 27 comment.title = 'hub-message-twitter'
27 comment.source = options.page 28 comment.source = options.page
28 comment.body = comment_text 29 comment.body = comment_text
29 comment.author_id = options.author_id 30 comment.author_id = options.author_id
30 - comment.name = ic.iconv(parsed["user"]["name"])[0..-2] 31 + #Attention please, don't remove + ' ')[0..-2] it is used for UTF8 validation
  32 + comment.name = ic.iconv(parsed["user"]["name"] + ' ')[0..-2]
31 comment.email = 'admin@localhost.local' 33 comment.email = 'admin@localhost.local'
32 comment.save! 34 comment.save!
33 rescue => e 35 rescue => e