nieldlr/hanzi

黃 decomposition error

Closed this issue · 2 comments

Trying to do a hanzi.decompose('黃') fails with an error:

        if(components.length == 2){
                     ^
TypeError: Cannot read property 'length' of undefined

That line is in hanzidecomposer.js, graphicalDecomposition method.

I've narrowed the error, before failing the code does 4 components lookups:

Looking up: 黃
Looking up: 黃
Looking up: 廿
Looking up: 卄

but cannot be found on cjk-decomp.txt.

Yes, I've got a list of characters going that don't work with the data. I'm going to have manually edit the files to make them work. Sometimes small things, like encoding differences create these errors. I have changed quite a bit of data so far. I'll do this one too.

I've fixed this in the latest update. Even if the 卄 could not be found (which is a problem with the data), it falls back to the character that created the lookup.