R
R
Ruslan Leviev2012-04-09 11:50:26
OAuth
Ruslan Leviev, 2012-04-09 11:50:26

PHP: tweeting, caption calculation?

I built authorization through Twitter into the site (I use the Twitter-async library from Jaisen Mathai ), now I want the user to automatically post a message to his Twitter when changing the profile on the site.
But here a problem arises: Russian messages are simply not sent. More precisely, the whole problem is (as I understand it) that the request signature is incorrectly calculated. Googled - many have the same problem, everyone nods towards UTF-8 characters.
I looked at the source code of the library, but there, in theory, everything is fine, each parameter is processed like this:

public function encode($string)<br>
{<br>
  return rawurlencode(utf8_encode($string));<br>
}<br>

I also tried replacing with:
public function encode($string)<br>
{<br>
  return rawurlencode(iconv('windows-1251', 'UTF-8', $string));<br>
}<br>

didn't help either. I tried other libraries (in particular TmhOAuth by Matt Harris ) - the situation is completely similar.
If this is important, then I built the libraries into Kohana 3.2
Where to dig, where could there be a problem?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
6
65520, 2012-04-09
@65520

I use this Bible , Russian is ok. I have unicode everywhere.

I
Ivan, 2012-04-09
@dohlik

Have you tried the Kohana libraries? The same OAuth should work.

D
dali, 2012-04-09
@dali

How is the message length checked? my records were in utf-8, as a result, the message length was calculated incorrectly, the messages exceeded the limit and were not published

F
fozzy, 2012-04-13
@fozzy

1. PHP version?
2. Is extension mb_string installed
If PHP < 5.3.10 and there is mb_string, use mb_strlen instead of strlen ( proof )
in 5.4 to calculate the length of the UTF-8 string, seems to be fixed.

G
galaxy, 2012-04-13
@galaxy

Xs, I took the version from github (Twitter-async by Jaisen Mathai) - the test worked: twitter.com/# !/jmathai_test/status/190858746497470464

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question