admin管理员组文章数量:1194346
In my Flutter app, using ChatGPT API (model gpt-4o-mini) and requesting a mixture of English and Hebrew in Json response, it receives the Hebrew as UTF8 Hex (each Hebrew character taking 2 bytes).
eg. "Sentence": "××××× ××× ××¦× ×©× ×¢×××ת ××× ×§××צ×ת ×× ×××× ×ת."
- where each x above is 0xD7, and is followed by, for example, 0x94 (for Hebrew ה)
How can I convert this to displayable Hebrew?
I have tried 'Content-Type': 'application/json; charset=UTF-8' and also 'Content-Type': 'application/json' in the https request, with the same result.
The prompt used is: "Act as a Hebrew assistant that returns and replies valid, iterable JSON response, and provide a meaningful sentence in Hebrew, with Hebrew letters - not hexadecimal, with key Sentence, along with the English translation, with key Translation, for the Hebrew word: ".
A test using curl returns the Hebrew directly, as does ChatGPT on my MacBook Pro.
Any help is appreciated.
In my Flutter app, using ChatGPT API (model gpt-4o-mini) and requesting a mixture of English and Hebrew in Json response, it receives the Hebrew as UTF8 Hex (each Hebrew character taking 2 bytes).
eg. "Sentence": "××××× ××× ××¦× ×©× ×¢×××ת ××× ×§××צ×ת ×× ×××× ×ת."
- where each x above is 0xD7, and is followed by, for example, 0x94 (for Hebrew ה)
How can I convert this to displayable Hebrew?
I have tried 'Content-Type': 'application/json; charset=UTF-8' and also 'Content-Type': 'application/json' in the https request, with the same result.
The prompt used is: "Act as a Hebrew assistant that returns and replies valid, iterable JSON response, and provide a meaningful sentence in Hebrew, with Hebrew letters - not hexadecimal, with key Sentence, along with the English translation, with key Translation, for the Hebrew word: ".
A test using curl returns the Hebrew directly, as does ChatGPT on my MacBook Pro.
Any help is appreciated.
Share Improve this question edited Jan 24 at 13:09 VLAZ 29k9 gold badges62 silver badges82 bronze badges asked Jan 24 at 13:08 Colin GColin G 4175 silver badges14 bronze badges 5 |1 Answer
Reset to default 0I found a solution by switching to use the dart_openai package, which returns Hebrew as Hebrew characters.
Thanks for your responses.
本文标签: utf 8How to convert UTF8 Hex to Hebrew letters in FlutterDartStack Overflow
版权声明:本文标题:utf 8 - How to convert UTF8 Hex to Hebrew letters in FlutterDart - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738416332a2085604.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
0xD7 0x94
? – deceze ♦ Commented Jan 24 at 13:13utf8.decode
on it. – jamesdlin Commented Jan 24 at 16:57map
is a JSON string. Therefore you have to use JSON methods to turn it into a JSON object first, and then decode the text. Or simply decode the whole JSON string as UTF8 – k314159 Commented Jan 25 at 11:34