Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Java, Unicode, and supplementary characters question

 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have code like this:

It contains 4 code units: the first and the last areo some Asian chars (found it on the web somewhere), ant the 2 inside comprise a supplementary char. The code prints out what expected: 4 units, 3 points. What I am curious about is that when I display it using Swing, it prints the Asian chars correctly, but it fails for the supplementary char, printing just an empty box. It is no surprise that System.out prints ??? to the console (Vista Home Premium), but why is the middle character not shown correctly? Does it have to do anything with a font not having a glyph for this code point? The code point was taken from here: http://java.sun.com/developer/technicalArticles/Intl/Supplementary/ (scroll a little down, the first table with 4 characters, the last one, kind of an small letter 'a').

Raf
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Raf Szczypiorski wrote:Does it have to do anything with a font not having a glyph for this code point?


Possibly. Which font are you using?
 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, I don't know, how can I check that? I haven't changed anything in the swing configuration in any way.
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what Swing's default font is, but I'm certain that it doesn't even include all BMP 0 characters, much less anything that's in one of the other BMPs.

Here are fonts that might include those characters: http://www.code2000.net/
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic