61892

Java not displaying a special UTF symbol?

Question:

I have successfully been calling Unicode characters in Java. However, I cannot call this particular symbol of a pedestrian... <a href="http://www.fileformat.info/info/unicode/char/1f6b6/index.htm" rel="nofollow">http://www.fileformat.info/info/unicode/char/1f6b6/index.htm</a>

I am following the directions on the website but it displays an empty block:

JOptionPane.showMessageDialog(null,"\uD83D\uDEB6");

What am I doing wrong?

Answer1:

This is a font issue. The font(s) being used do(es) not contain a glyph for the character, hence the rendering software displays a generic symbol like a rectangle instead.

If you follow the link <a href="http://www.fileformat.info/info/unicode/char/1f6b6/index.htm" rel="nofollow">Fonts that support U+1F6B6</a> on the page you mention in the question, you will get the information that only <a href="http://users.teilar.gr/~g1951d/" rel="nofollow">Symbola</a> contains the character PEDESTRIAN (U+1F6B6). (The LastResort font mentioned there is a pseudo-font, useful in software development but not in rendering characters.) This should not be a surprise, as it was introduced in Unicode 6, in 2010. It generally takes about ten years or more for a character to get reasonably well supported in fonts.

Sufficiently new versions of Segoe UI Symbol also contain U+1F6B6, but Segoe UI Symbol is proprietary, shipped with Windows 7 and Windows 8, and you may need an update to it to get a version that supports U+1F6B6. Symbola, on the other hand, is a free font.

Answer2:

It's not necessarily that you're doing something wrong (though you failed to give a code example in context).

Bear in mind, if you didn't already know, that most computers have <em>only a portion</em> of the unicode set installed. There are a number of funny characters like that that won't work on every computer.

Some are safe - like the accented á, etc. - but not all of them.

Generally, if you found one that wasn't installed on your computer, I would avoid trying to get it onto your computer - if you ever plan for that Java program to run anywhere else (which is the idea of Java, right?) - since your program would fail on any other computer without it.

Sorry to disappoint - I've felt the same disappointment when I found cool things that didn't work in unicode.

<a href="http://smallbusiness.chron.com/unicode-symbols-not-display-java-39315.html" rel="nofollow">http://smallbusiness.chron.com/unicode-symbols-not-display-java-39315.html</a>

<a href="http://knowyourmeme.com/memes/this-is-bob" rel="nofollow">http://knowyourmeme.com/memes/this-is-bob</a>

Recommend

  • What products support 3-digit region subtags, e.g., es-419 for Latin-American Spanish?
  • Getting coordinates of a component in java
  • Eclipse dark color theme fixes
  • Circle movement upon rectangle Collision
  • Is it possible to “shrink” a PdfPtable?
  • c# winform DrawToBitmap offscreen
  • is it possible to insert a line break in this tooltip?
  • How to discover Font Type?
  • Deleting empty Series out of Graph (with VBA)
  • Opaque reference instead of PImpl. Is it possible?
  • Does CSS support inheritance [duplicate]
  • Why people use prototype in javascript when it is easy to inherit using apply () and call () methods
  • Understanding RTF and edit it with vb.net
  • Trying to string.Join an IList
  • C++ Single function pointer for all template instances
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • How To Customize ASP.NET Chart Databound To SqlDataSource
  • Remove final comma from string in vb.net
  • Webgrid not refreshing after delete MVC
  • How to change the font size of a single index for UISegmentedControl?
  • Test if a set exists before trying to drop it
  • Jquery UI tool tip close icon
  • Highlight and Bold text in JTextPane
  • Django: Count of Group Elements
  • How to do unit test for HttpContext.Current.Server.MapPath
  • How to rebase a series of branches?
  • Xamarin Forms - UWP Fonts
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Different response to non-authenticated users and AJAX calls
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Can I make an Android app that runs a web view in Chrome 39?
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Change an a tag attribute in JavaScript based on screen width
  • Microsoft Visual Studio Community 2015 always crashes in Windows 10 if swithed to Visual FoxPro
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Unanticipated behavior
  • Traverse Array and Display in markup
  • Data Validation Drop Down Box Arrow Disappearing
  • How to include full .NET prerequisite for Wix Burn installer
  • Qt: Run a script BEFORE make