1

My application is used by Japanese clients, supports languages as English/Japanese.

The charset used in our html files are UTF-8.

When we are in Japanese language selected, the input field while entering Numbers, they need to switch off the Hiragana input mode.

Can it be possible to switch off Hiragana specifically for input fields with type="number" or not ?

We are using html, jquery for our application.

Check the difference below which is creating the issue:

Japanese Hiragana mode - @1231231313 English Mode - @1231231313

GOK
  • 2,338
  • 6
  • 34
  • 63
  • Why would you switch off UTF-8 for English texts? Most English characters occupy one byte in UTF-8. – Jukka K. Korpela Jun 17 '13 at 11:23
  • Please see the 14 and 16 are much bigger in size and spacing in Hiragana mode of input.. that needs to be in english alphabets... – GOK Jun 18 '13 at 10:58
  • The shapes of the characters do not depend on encoding. Please describe your problem in concrete terms: what you did, including the relevant code, what was expected, what happened, and what you see as a problem there. – Jukka K. Korpela Jun 18 '13 at 13:29
  • Please check the above edited question – GOK Jun 19 '13 at 06:35
  • Still no code. There is something in your code that makes the browser use different fonts in different situations. You have not described what these modes are and how they are taken into use. – Jukka K. Korpela Jun 19 '13 at 08:37

1 Answers1

1

You cannot store Japanese characters in a single byte. A single byte allows you a maximum of 256 possible values to be stored, that's nowhere near enough for a full Japanese alphabet. If you need to store arbitrary Japanese text, you need to support an encoding which supports Japanese, which is necessarily going use multiple bytes per character.

If you only need to support a specific subset of Japanese, e.g. only the characters "分時月年" etc, you can make this anything you want by storing some random byte in the database and map that to the character in some standard encoding as necessary. E.g.:

$intoDatabase = str_replace('時', chr(245), $string);

$fromDatabase = str_replace(chr(245), '時', $string);

Just make sure you're not using the byte 245 for other characters.

See UTF-8 all the way through and What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text.

Community
  • 1
  • 1
deceze
  • 510,633
  • 85
  • 743
  • 889