[SailfishDevel] Current font doesn't support cyrillic.

Jonni Rainisto jonni.rainisto at jollamobile.com
Mon Mar 25 14:08:22 UTC 2013


Hi,

Are you sure that you just haven't forgotten to set locale codec before 
calling qDebug() or forgotten to use ::fromUtf8?

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
      qDebug() << 
QString::fromUtf8("\u0421\u043f\u043e\u0441\u043e\u0431 
\u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 
\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 DLL \u0432 
\u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 
\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e 
\u043f - 
\u041d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432");

At least for me it produces right looking output (disclaimer, I don't 
know how it should look like...):

"?????? ?????????????? ???????? DLL ? ???????? ???????????? ? - 
????????????"


re, Jonni


On 03/25/2013 02:11 PM, Oleg Linkin wrote:
>
> Hello.
>
> I got the problem with cyrillic russian symbols when I try to "qDebug 
> ()" json data with russina letters. In output there is no any russian 
> letters and in their places there are gaps.
>
> 1. This is part of networkreply->readAll ():
>
> {"item_id":"320043892","resolved_id":"320043892","given_url":"http":\/\/www.rsdn.ru\/forum\/asm\/2729722.flat","given_title":"\u0421\u043f\u043e\u0441\u043e\u0431 
> \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 
> \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 DLL \u0432 
> \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 
> \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e 
> \u043f - 
> \u041d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432","favorite":"0","status":"0","time_added":"1363782570","time_updated":"1364074862","time_read":"0","time_favorited":"0","sort_id":7,"resolved_title":"\u0421\u043f\u043e\u0441\u043e\u0431 
> \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 
> \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 DLL \u0432 
> \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 
> \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e 
> \u043f","resolved_url":"http:\/\/www.rsdn.ru\/forum\/asm\/2729722.flat","excerpt":"\u0421\u043f\u0430\u0441\u0438\u0431\u043e 
> \u0437\u0430 \u043e\u0442\u043a\u043b\u0438\u043a! 
> \u0421\u0421>>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e 
> \u043b\u0438\u0431\u043e 
> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c 
> \u043b\u043e\u0433\u0438\u043a\u0443 
> \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 
> \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, 
> \u043b\u0438\u0431\u043e 
> \u043e\u0442\u043b\u043e\u0436\u0438\u0442\u044c 
> \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 
> \u043d\u0443\u0436\u043d\u043e\u0439 DLL 
> (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c 
> \u043a\u0430\u043a 
> inject.","is_article":"1","is_index":"0","has_video":"0","has_image":"0","word_count":"67"}
>
> 2. The same part after generating QVariantmap via QJson::Parser:
>
> ( "320043892" , QVariant(QVariantMap, QMap(("excerpt", 
> QVariant(QString, " ! >> , DLL ( inject.") ) ( "favorite" , 
> QVariant(QString, "0") ) ( "given_title" , QVariant(QString, " DLL - 
> ") ) ( "given_url" , QVariant(QString, 
> "http://www.rsdn.ru/forum/asm/2729722.flat") ) ( "has_image" , 
> QVariant(QString, "0") ) ( "has_video" , QVariant(QString, "0") ) ( 
> "is_article" , QVariant(QString, "1") ) ( "is_index" , 
> QVariant(QString, "0") ) ( "item_id" , QVariant(QString, "320043892") 
> ) ( "resolved_id" , QVariant(QString, "320043892") ) ( 
> "resolved_title" , QVariant(QString, " DLL ") ) ( "resolved_url" , 
> QVariant(QString, "http://www.rsdn.ru/forum/asm/2729722.flat") ) ( 
> "sort_id" , QVariant(qulonglong, 7) ) ( "status" , QVariant(QString, 
> "0") ) ( "time_added" , QVariant(QString, "1363782570") ) ( 
> "time_favorited" , QVariant(QString, "0") ) ( "time_read" , 
> QVariant(QString, "0") ) ( "time_updated" , QVariant(QString, 
> "1364074862") ) ( "word_count" , QVariant(QString, "67") ) ) ) )
>
> 3. But when I try to show this strings in view - russian text exists 
> but it has strange view:
>
> https://lh5.googleusercontent.com/-YMyQqrXkhqA/UU4nhu1sHbI/AAAAAAAABEg/Yx7Cz_kczdg/s808/sailfish_cyrillic_view.png
>
>
> -----------------------------------------
>
>
> -----------------------------------------
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sailfishos.org/pipermail/devel/attachments/20130325/7c6732e7/attachment.html>


More information about the Devel mailing list