Today, I was going through a lesson on udacity about the Java Persistence API (JPA) and one of the example exercises was to write a Java program to store data with the JPA that, among other things:
Make sure that both the flower name and recipient name will support international language characters
In the context of the lesson, the Java annotation @Nationalized is presented, which apparently enables "National" character support.
I paused. Like Spanish? ¿Que pasa? That's not international enough for you?
Of course, obviously, this requirement is talking about multi-byte characters, which are ubiquitous in Chineese, Japanese, and other logographic writing systems, which is why we have Unicode and the best representation, UTF-8. There are tons of blog posts that talk about this, and I'm well aware to always choose UTF-8.
But this is a Java application. Moreover, this is JPA, and the Java persistence API supports every database. Including databases that don't support UTF-8, the barbarians.
This became clear to me when I read this stack overflow post. The annotation doesn't exist to support Unicode, it exists to tell the database that if it's not already supporting Unicode, it better figure something out for this field because "national" characters are going into it.
By the way, welcome to my blog. I'm going to focus on explaining tidbits of knowledge that I gained while practicing programming. If that fails, I'll share some other kind of tidbit. Here's to 2022.
No comments:
Post a Comment