Korean keyboard won't type korean syllables

This issue has been tracked since 2021-12-25.

Hi Francisco,

For example: it should be "워", but it always types as '우 ㅓ'. How can I fix the problem? Thank you in advance.

korean-keyboard

hodgef wrote this answer on 2021-12-27

Hello Andrey, in most language layouts we rely on unicode character composition, which I don't think is working here. However, I've recently moved towards candidate box suggestions / IME starting with the Chinese (Pinyin) keyboard.

keyNavCandidates2

I think the best way to address your concerns is to move the Korean layout to this kind of input method. To accomplish this, I would need a detailed list of key candidates, such as this one: https://github.com/simple-keyboard/simple-keyboard-layouts/blob/master/src/lib/layouts/chinese.ts#L24

I will keep this task open as I look further into this.

Regards,
Francisco Hodge

hanuz06 wrote this answer on 2022-01-01

Hi Francisco,

Thank you for your reply. It's cool that the project is alive. The Korean language uses the alphabet and words are made of syllables. Luckily, there are fewer syllable constructions than in Chinese. It looks like this site has all possible Korean syllables combinations: Korean-syllables. Hopefully, this helps. Thank you for your hard efforts.

hodgef wrote this answer on 2022-01-06

Thanks for the information, I will look into this soon

hodgef wrote this answer on 2022-01-16

Hello Andrey,

I have pushed updates to simple-keyboard and simple-keyboard-layouts to support Korean CandidateBox.

To try it out, please upgrade to the following:

Demo: https://codesandbox.io/s/fragrant-dawn-1w9eh?file=/src/index.js

Here's the layout that was changed:
https://github.com/simple-keyboard/simple-keyboard-layouts/blob/master/src/lib/layouts/korean.ts

Note: There will probably be some issues, such as missing syllabes, redundant or wrong entries, among others. I cannot verify as I'm not a native Korean speaker, so I will rely on the community to modify the layout linked above and submit PRs as needed.

Regards,
Francisco Hodge

hodgef wrote this answer on 2022-01-17

I have published the update to [email protected]

You can get your React setup to work by following this example:
https://codesandbox.io/s/mutable-framework-0y51i?file=/src/index.js

Regards,
Francisco Hodge

hanuz06 wrote this answer on 2022-01-17

Thank you very much, Francisco.

hanuz06 wrote this answer on 2022-02-07

@hodgef
Hi Francisco,

I wonder if korean keyboard is in unicode? With korean keyboard it shows correct syllables but it's not recognized by code. I investigated and found that same words typed from keyboard and typed from virtual keyboard have different character code.

I think the problem is that currently words typed from virtual keyboard are considered as a sequence of letters like in English but korean syllables have separate code type. For example: In a word "신", ㅅ = U+3145, ㅣ= U+3163, ㄴ = U+3134, and 신=U+C2E0. In virtual keyboard may show syllables as U+3145/U+3163/U+3134 but it should be U+C2E0.

So I wonder if it's possible to assign unicode to each syllable? If necessary I can make a list with each syllable assigned to corresponding unicode code.

This character codes for a word from virtual keyboard(String length is 6 because it considers the word as a sequence of letters):

utf8-virtual

This character codes for a word from real keyboard(String length is 2 because it considers the as a sequence of syllables):

utf8-real

hanuz06 wrote this answer on 2022-02-07

Actually the syllable code can be reliably calculated if we know all letters composing that syllable. So when a user clicks on that small window to make a syllable, the program can generate a syllable unicode code.

https://en.wikipedia.org/wiki/Korean_language_and_computers#Hangul_in_Unicode

hodgef wrote this answer on 2022-02-07

Hello @hanuz06,

Once you select a CandidateBox item, the item is decomposed like this:

const normalizedCandidate = selectedCandidate.normalize("NFD");

This is helpful if you made a mistake, as it allows you to hit backspace and remove that last portion of the syllabe (triggering the CandidateBox) instead of deleting the whole syllabe and starting over.

You can try out the various normalize functions to see their effect:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize

In that page there's a box that you can use to run your code. Try entering this:

const name1 = '신';
const name2 = '신';

console.log(`${name1}, ${name2}`, name1.length, name2.length);
console.log(name1 === name2);
console.log(name1.length === name2.length);

const name1NFC = name1.normalize('NFC');
const name2NFC = name2.normalize('NFC');

console.log(`${name1NFC}, ${name2NFC}`, name1NFC.length, name2NFC.length);
console.log(name1NFC === name2NFC);
console.log(name1NFC.length === name2NFC.length);

Returns:

> "신, 신" 3 1
> false
> false
> "신, 신" 1 1
> true
> true

Regards,
Francisco Hodge

hanuz06 wrote this answer on 2022-02-07

Thank you very much Francisco. normalize('NFC') works for korean syllables.

More Details About Repo
Owner Name hodgef
Repo Name simple-keyboard
Full Name hodgef/simple-keyboard
Language JavaScript
Created Date 2018-03-02
Updated Date 2022-12-02
Star Count 1737
Watcher Count 20
Fork Count 130
Issue Count 0

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date