Commit a30855a
committed
feat(unicode): add UniCode demo for exploring Unicode character ranges
What
- Introduced UniCode class to demonstrate working with Unicode characters in Java.
- Prints:
- Greek and Coptic characters from U+0370 to U+03FF.
- Devanagari characters from U+0900 up to U+0970.
- Declared a sample char `x = 0x03c8` (Greek letter psi).
Why
- Showcases how Java `char` type supports Unicode (16-bit, UTF-16).
- Demonstrates direct use of Unicode code points via hexadecimal literals.
- Provides practical insight into multilingual text handling in Java.
How to use
- Run UniCode.
- Output will display:
1. Greek letters and symbols sequentially.
2. Devanagari script characters sequentially.
Real-life applications
- Rendering multilingual UIs (Greek, Hindi, etc.).
- Handling internationalization (i18n) and localization (l10n).
- Generating or parsing Unicode text for fonts, editors, or compilers.
- Learning how Unicode blocks map to Java `char`.
Notes
- Java `char` represents UTF-16 code units (not full Unicode code points above U+FFFF).
- For supplementary characters (outside BMP), use `int` and methods like `Character.toChars()`.
- The loop with `0x0900` to `0x970` prints the Devanagari block, but should use `0x0970` (typo fix recommended).
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent 00ced75 commit a30855a
1 file changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments