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
Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

ascii symbols

I'm trying to display ⚅ in my app but it always shows as a box with an X through it. 

 

Anyway to fix this?

_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Re: ascii symbols

what is the actual character?... I don't think the forum software picked it up right. You might want to try describing it and/or pointing to an online reference.

 

Try finding the UTF-8 character... if referenced correctly in your app I'd like to believe it should work.


PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Re: ascii symbols

It's die face-6

U+2685
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: ascii symbols

The character encoding of your source code is not UTF-8 by default, so you have to prefix any string/character literals to make this all work.  So if you want this as a character, try using:

QChar(L'\u2685')

 

Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Re: ascii symbols

I changed it from

dice = "⚅"

to

dice = QChar(L'\u2685')

But it produces errors:

Multiple markers at this line
- extraneous input ''\u2685'' expecting RPAREN
- Unexpected token `string literal'
- Unknown symbol 'L'
- Unknown symbol 'QChar'
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: ascii symbols

[ Edited ]

I am sure that there is typo, QChar(L'\u2685') was probably meant to be QChar('\u2685')

Edit:  Not true - my mistake, see next. 

 

However I suspect a missing glyph (or two).  Try the following:

 

QString diceTestString = QString::fromUtf8("\u263A \u2685.");

 

Display this and you will see the smiley face, but the die unicode values all display as the box with the X.  .

Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: ascii symbols

It was not a typo.  The string literal format isn't UTF-8 / Unicode by default (unless you explicitly change it), so it actually won't work correctly unless you use that L prefix.  The same is actually true for strings like the one in your example, in many cases.

 

However, I think the Philipk was asking a QML question (without specifying as such), and I gave a C++ answer.  He then pasted it into his QML, and obviously got a bunch of errors.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: ascii symbols

[ Edited ]

My mistake, QT/C++ still not a strong suit....

 

That said, the QString test above does create a String that when displayed, shows a smily face and a box with X.  So I think the die symbols are not there.

Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Re: ascii symbols

**bleep**, I guess I'll have to use images or wait for custom fonts.
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis