databird / npptranslate64

14 stars 3 forks source link

dont work #1

Open Trygve-Husky opened 7 months ago

Trygve-Husky commented 7 months ago

搜狗高速浏览器截图20240301130040

databird commented 7 months ago

403 mean "forbiden", maybe you enter a wrong API key.

Please go to "Translate > Translate Engine Settings" : image

And enter the API key for "Deepl" or, for other engine, enter required infos.

ming019 commented 7 months ago

Similar issue, image (I filled my own email tho) image Language: From Simplified Chinese to Traditional Chinese When attempt to "Translate selected", image it says, [ value cannot be null. Parameter name: text]

databird commented 7 months ago

Unfortunately, it's working on my computer with same settings than yours...

You can check on logs that are located on "C:\Users[User]\AppData\Roaming\Notepad++\plugins\logs\Translate\xxx.log" to find the cause.

ming019 commented 7 months ago

https://pastebin.com/w1zHBhSK

It has the same issue no matter I fill my email or not. Editing XML file in UTF-8.

Will check later on another machine

databird commented 7 months ago

The problem seems to be encoding conversion. On original NPPTranslate plugin, it convert ISO-1252 to UTF-8 on function getSelectedText() :

Main.cs:225

                Util.writeInfoLog("Selected text range: " + selected);

                logEncodingInfo();

                Encoding w1252 = Encoding.GetEncoding(1252);
                string converted = Encoding.UTF8.GetString(w1252.GetBytes(selected));

                Util.writeInfoLog("Final selected text after conversion: " + converted);

And in your case it's already UTF-8, so conversion failed, and passed string to translate engine is "??????????" and that cause the error.

ming019 commented 7 months ago

Tested again on another document in UTF-8 encoding, Chinese(Simplified)->Chinese(Traditinal). No error pops up but only ??????. image I suspect it encounter issues as Chinese Characters isn't a part of w1252?