Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
5alid
Posts: 17
Registered: ‎12-30-2013
My Device: Q5
Accepted Solution

Arabic writing in C ++ ( Text not code )

[ Edited ]

Hello everyone

I have a problem writing in Arabic in the file xxxxx.cpp
I do not want translation, I want to be the only application Arabic.
I have to change the coding to UTF-8, and nothing has changed.

Such as:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank you all :Clap:

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Arabic writing in C ++ ( Text not code )

[ Edited ]

Hi! Welcome to the forums. Please attach a test project to reproduce this.


Andrey Fidrya, @zmeyc on twitter
New Developer
5alid
Posts: 17
Registered: ‎12-30-2013
My Device: Q5

Re: Arabic writing in C ++ ( Text not code )

Thank you Zmey :Yes:

 

I've created a simple project

 

Download

New Developer
5alid
Posts: 17
Registered: ‎12-30-2013
My Device: Q5

Re: Arabic writing in C ++ ( Text not code )

I'm waiting...

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Arabic writing in C ++ ( Text not code )

Conversion from string constant (char *) to QString is Latin1 by default.

 

You'll need to convert it from Utf8 explicitly:

toastCancelBtn->setLabel(QString::fromUtf8("…text..."));

 

 Or, even better solution: change the default codec to Utf8. This can be done once in main.cpp:

 

Q_DECL_EXPORT int main(int argc, char **argv)
{
  Application app(argc, argv);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

 This will work correctly now:

toastCancelBtn->setLabel("…text...");

 


Andrey Fidrya, @zmeyc on twitter
New Developer
5alid
Posts: 17
Registered: ‎12-30-2013
My Device: Q5

Re: Arabic writing in C ++ ( Text not code )

Thank you!

The second solution is the best.