Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

utf8 character values

dave1707dave1707 Mod
in General Posts: 8,179

If you want to see what hex value you need to put in a UTF8 \u{xxxx} statement to display a certain emoji or other characters, here's a quick viewer. To view the values and characters, slide your finger up or down the screen. Slide up/down near the left side to change the values by 1. Slide up/down in the middle to change the valuse by 100. Slide up/down near the right side to change the values by 1000. Not all values have an image and the range is limited from 0 to 2ffff.


displayMode(FULLSCREEN) function setup() textMode(CORNER) fontSize(40) start=128000 dy=0 end function draw() background(255) c=0 for z=start,start+19 do c=c+1 text("\\u{"..string.format("%0x",z).."}",200,HEIGHT-c*50+dy) text(utf8.char(z),400,HEIGHT-c*50+dy) end end function touched(t) if t.state==MOVING then if t.x>WIDTH*.66 then v=1000 elseif t.x>WIDTH*.33 then v=100 else v=1 end if t.deltaY>0 then start=start+v else start=start-v end start=math.max(0,start) start=math.min(196588,start) end end

Comments

  • dave1707dave1707 Mod
    Posts: 8,179

    @yojimbo2000 I looked at that, but you have to have the emoji character to paste into the clipboard. This viewer lets you look at all the UTF8 values from 0 to 2ffff.

  • Posts: 2,020

    I updated it so that you can type into the text box as well. I figured that if you've been using emoji in Codea, you must have an emoji or a symbol keyboard installed. For iOS 8 users, I really recommend the keyboard called "Symbols", it has loads of cool stuff, as well as emoji.

    Nice to have a utf 8 browser though. I like how it defaults to alien head if it's a symbol that isnt on the iPad.

  • dave1707dave1707 Mod
    Posts: 8,179

    @yojimbo2000 There are a lot of values that don't show using the emoji keyboard option. Probably 99 percent of the values viewed with this code won't be used, but it's still nice to see what can be used.

  • Posts: 2,020

    This is the symbols keyboard I was talking about for those extra characters:

    https://itunes.apple.com/en/app/symbols-special-text-characters/id652475637?mt=8#

  • dave1707dave1707 Mod
    Posts: 8,179

    @yojimbo2000 I just use the iPad and it's keyboard and I'm sure a lot of other people do also. Besides, I don't write anything that really needs UTF8 characters. I was just curious what characters were available.

  • Posts: 2,020

    I'm a keyboards junkie! Probably my favourite feature of iOS 8

  • Posts: 480

    Outside Codea there's an app called "Fonts" which I use for finding symbols. It also shows which fonts have the symbols as not all do. There's also the website fileformat which is great for finding symbols and characters by description.

  • Posts: 2,020

    @LoopSpace thanks for the tips re "Fonts", that's a nice font browser (tho depressing to read all the one-star reviews from people saying, "WTF, this doesn't change the font on my phone" etc). I've been using "FondFont" to install extra fonts to use in Codea, it's not as nice a browser as Fonts tho.

    I wonder whether there's a way in Codea to work out which unicode characters are visible on the iPad. Then you could write your own version of the "Symbols" keyboard I linked to above, automatically missing out all of the undisplayable characters

Sign In or Register to comment.