RyotaUshio / obsidian-pdf-plus

The most Obsidian-native PDF annotation, viewing & editing tool ever. Comes with optional Vim keybindings.
https://ryotaushio.github.io/obsidian-pdf-plus/
MIT License
470 stars 11 forks source link

[Bug] {{text}} or {{selection}} doesn't work for Korean Language #173

Closed danhyun-jeong closed 2 months ago

danhyun-jeong commented 2 months ago

Steps to reproduce

  1. Open any pdf files written in Korean language
  2. Use "copy link to selection" function, via format including text (in other words, format including '{{text}}' or '{{selection}}')
  3. Go to any note files, and paste(cmd+v)

Expected behavior

No matter what copy link template you use, you expect the '{{text}}' part of that template will have exactly the same string as the part you selected in the PDF file.

Actual behavior

However, the string in that part is actually copied differently. Interestingly, the actual text(string) that is pasted when copying from the pdf file with simple 'cmd+v' and when using 'copy link to selection' does not match. What's different is that if you run 'copy link to selection' with a costumed template that includes '{{text}}', all the spaces in the string disappear!

Screen recordings or screenshots (sandbox vault)

화면 기록 2024-04-24 오후 10.15.00.zip

Obsidian debug info

sorry for not filling this

PDF++ debug info

sorry for not filling this

Error messages

No response

RyotaUshio commented 2 months ago

I believe it's actually not a bug, but it's due to the "Remove half-width whitespace between two CJK characters when copying text" option. Turning it off will give you the expected result.

Untitled

RyotaUshio commented 2 months ago

@danhyun-jeong I'm not familiar with the Korean language but perhaps this option doesn't make sense for Korean speakers? I assumed that the same spacing rule as Japanese and Chinese also applies to Korean... sorry for the ignorance. I will exclude Korean characters from the target of this option.

RyotaUshio commented 2 months ago

Released as 0.39.22! Thanks for letting me know about this.

danhyun-jeong commented 2 months ago

First of all, thank you for promptly addressing my report. Wow... I never thought such an option would exist, so I didn't anticipate that the issue I reported would be related to that feature at all. Therefore, I naturally thought it was some sort of bug. To answer your question, Korean is the only language among East Asian languages that uses spacing. Neither Japanese nor Chinese use spacing, but Korean does, so for documents in Korean, that option could be considered nonsense. However, I believe it could be useful for languages like Japanese or Chinese. Therefore, for Korean, it would be better if that option were not applied, similar to European languages like English.

danhyun-jeong commented 2 months ago

I appreciate you developing this plugin. You're my savior... I believe Obsidian should have integrated this feature natively, but while they didn't, you solved this issue. Thank you.

RyotaUshio commented 2 months ago

Thank you for the explanation and the kind words! Glad you found it helpful.