Darren Gates
Darren Gates

Reputation: 611

how to strikethrough Japanese text using unicode characters

Please take a look at this jsfiddle:

https://jsfiddle.net/darrengates/c5mwohb7/

If you open the console in jsfiddle, you'll see that Japanese text does not "strikethrough" the same way that English does.

English strikethrough: t̶h̶i̶s̶ ̶i̶s̶ ̶E̶n̶g̶l̶i̶s̶h̶ ̶s̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶

Japanese strikethrough (on my screen just a bunch of rectangles with lines through): の̶ス̶レ̶ッ̶ド̶で̶、̶ス̶ク̶リ̶ー̶ン̶シ̶

I'm hoping for some way to be able to strikethrough (without using or other html tag-based method) of achieving strikethrough for Japanese and potentially other Asian languages.

Here's the code from the fiddle:

function strike(text) {
    return text
        .split('')
        .map((char) => {
            return char + '\u0336'
        })
        .join('')
}

console.log(strike('this is English strikethrough'))

console.log(strike('のスレッドで、スクリーンシ'))

Upvotes: 1

Views: 716

Answers (1)

Darren Gates
Darren Gates

Reputation: 611

It does not appear that there is a simple Unicode solution to this issue. Using HTML's (or ) appears to be the best approach. As @skomisa noted in his comments, "text-decoration-style: double" is advisable when doing strikethrough with Japanese.

Upvotes: 1

Related Questions