node-chatgpt-api icon indicating copy to clipboard operation
node-chatgpt-api copied to clipboard

Cannot convert argument to a ByteString because the character at index 406 has a value of 28009 which is greater than 255.

Open LTDZ15 opened this issue 3 years ago • 9 comments

011 image

LTDZ15 avatar Apr 12 '23 08:04 LTDZ15

image

LTDZ15 avatar Apr 12 '23 08:04 LTDZ15

I believe this is due to your cookies having non-English characters in them. Try removing any cookies like that.

waylaidwanderer avatar Apr 12 '23 08:04 waylaidwanderer

image

LTDZ15 avatar Apr 12 '23 08:04 LTDZ15

Now the error has become like this

LTDZ15 avatar Apr 12 '23 08:04 LTDZ15

Maybe you didn't remove the cookie properly.

waylaidwanderer avatar Apr 12 '23 08:04 waylaidwanderer

Use userToken instead of cookies

vifdiwxfs avatar Apr 12 '23 15:04 vifdiwxfs

I encountered the error. The problem is that non-English characters that are URLencoded turn back to their original form automatically when I paste my cookies. One way to solve it is to change your location in your Bing “Settings and quick links” from non-English characters to English words. Another way is to try to find methods to keep the URLencoded form of cookies.

fvydjt avatar Apr 27 '23 03:04 fvydjt

how about this.

const iconv = require('iconv-lite');

// Convert cookie string to buffer const cookieBuffer = iconv.encode(cookieString, 'ascii');

// Convert buffer back to string const asciiCookieString = iconv.decode(cookieBuffer, 'ascii');

fcgca avatar May 12 '23 05:05 fcgca

Not perfect, but it worked.

iconv -f utf-8 -t ascii input.txt > output.txt

fcgca avatar May 12 '23 06:05 fcgca