JSR 310: A New Java Date/Time API by Jesse Farnham — Java SE’s Date and Calendar classes leave much to be desired. Will the third time be the charm? JSR 310, tracking for inclusion in Java SE 7, once again tries to offer a comprehensive date and time API, borrowing much of its design from the popular Joda Time API. In this article, Jesse Farnham takes a look at JSR 310’s concepts and how they may yet bring sense to dates and times in Java.
Language and geographic environment are two important influences on our culture. They create the system in which we interpret other people and events in our life. They also affect, even define, proper form for presenting ourselves and our thoughts to others. To communicate effectively with another person, we must consider and use that person’s culture, language, and environment.
Read Understanding Locale in the Java Platform for more details about how to use locale in your Java applications.
Adding input methods and font support for Japanese is a trivial process for Windows XP and Vista. After moving my laptop from XP to Ubuntu Linux, I realize that familiarity is…well…comfortable. I’m a little lost.
Really all I want to do is enable the Japanese input methods on this new, shiny Ubuntu 8.04 system. I tried installing SCIM and an input method called “Anthy”. Sigh…I couldn’t get it to work on first try, so I removed it. Of course I’ll try again, but I’ll do some Yahoo/Google search homework first.
Instead of loading and working with ResourceBundle files directly, you will use the ResourceManager and ResourceMap framework classes to manage resources. A ResourceMap contains the resources defined in a specific ResourceBundle implementation. A map also contains links to its parent chain of ResoureMap objects. The parent chain for any class includes the ResourceMap for that specific class, the application subclass to which the class belongs, and all superclasses of your application up to the base Application class.
escape function “encodes” a string by replacing non-ASCII letters and some other punctuation symbols with escape sequences of the form %XX, where X is a hex digit. Unicode characters from \u0080 through \u00FF are converted to the %XX form as well. Unicode characters in higher ranges take the form %uXXXX. So, as an example, the name José will take the form
Jos%E9. Go ahead, give it a try below:
The problem with this is that the escape mechanism is broken if you want to use UTF-8 as your document encoding. If you were dynamically composing URL strings with parameters, those parameters will definitely not be escaped correctly. Instead of
Jos%E9 that URI component should really be
escape function is deprecated in ECMAScript v 3. Instead, you should use the function
encodeURIComponent. These functions convert their argument to the UTF-8 encoding and then %XX encode all the non-ASCII characters. Two forms of the function exist so that you have greater control over whether characters like “?” and “&” are encoded. You’ll need to check your documentation for details. You can experiment with the
encodeURIComponent function here:
What’s this mean for you? Maybe nothing if you’re hopelessly attached to ISO-8859-1. However, if you’re trying to reach a global market with your product, chances are very good that you’ve decided to use UTF-8 for your character set encoding. That’s an excellent choice, but you’ll have to manage the conversion points. In a nutshell, that simply means that you’ll need to use UTF-8 from front to back consistently.
escape function. Take a look at
The Java SE 6 release provides an interesting new class:
java.net.IDN. It’s small, simple…very focused on a single task. That task has two parts:
- to convert domain names from practically any Unicode character to an
ASCII Compatible Encodingor
- to convert ACE names back into their full Unicode UTF-16 encoding