Pierric asked
Pierric replied
I’m noticing that when I add text directly to a table from the GUI, unicode characters are accepted. But when it’s over the API, I get the mentioned error.
Pierric replied
Additionally, it seems that MariaDB is using UTF-8 by default, and entries created directly from the GUI are stored correct as UTF-8. It’s just through the API that I’m getting this error 400 due to that MariaDB error.
Pierric replied
if that is useful, I am using linuxserver.io/mariadb on Arm7, together with the official nocodb container.
Pierric replied
Hmmm… I’m not sure I understand what you mean. Just to be clear after moving from sqlite to mariadb i didn’t reuse / migrate anything in the dB side. I created everything from scratch again.
o1lab replied
I reread the description, so it looks like it has to do with probably encoding or escaping those unicode? See what is the difference when compared to GUI and API
Pierric replied
that’s where I’m at a loss. I can’t really capture the API call going out from n8n (though if I have time and can’t solve this I might write a little Flask app to simulate the nocodb API and output the n8n request… happy to hear about better solutions if they exist!). But from the n8n source code it looks like the request should be good, and when I do a call to nocodb API directly from the console with CURL, I can insert utf-8 without problem. So I don’t see where the difference can be
Pierric replied
hmm … I did write a little “listener” in python and the request looks fine … here’s what the python looks like:
```python
import http.server as SimpleHTTPServer
import socketserver as SocketServer
import logging
PORT = 9876
class GetHandler(
SimpleHTTPServer.SimpleHTTPRequestHandler
):
def do_POST(self):
print(self.headers)
content_len = int(self.headers.get(‘content-length’, 0))
post_body = self.rfile.read(content_len)
print(post_body)
with open(‘output.txt’,‘wb’) as f:
f.write(post_body)
def do_GET(self):
logging.error(self.headers)
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
Handler = GetHandler
httpd = SocketServer.TCPServer((“”, PORT), Handler)
httpd.serve_forever()
```
and here’s the output.txt file:
```text
[{“gmailid”:“17f259931d268600”},{“gmailid”:“17f258573645e9e3”},{“gmailid”:“17f22604a66e97b3”,“subject”:“ “Les films doivent être des dessins qui prennent vie””},{“gmailid”:“17f2245118cccf93”},{“gmailid”:“17f222b4395f3ac4”}]
```
Pierric replied
it prints on screen (through the print command before I write to file) as:
```text
b’[{“gmailid”:“17f259931d268600”},{“gmailid”:“17f258573645e9e3”},{“gmailid”:“17f22604a66e97b3”,“subject”:“\xf0\x9f\x8e\xaa \xe2\x80\x9cLes films doivent \xc3\xaatre des dessins qui prennent vie\xe2\x80\x9d”},{“gmailid”:“17f2245118cccf93”},{“gmailid”:“17f222b4395f3ac4”}]’
```
Pierric replied
headers are as such:
```text
Accept: application/json
xc-auth: kljlk
Content-Type: application/json
User-Agent: axios/0.21.4
Content-Length: 232
Host: pi4:9876
Connection: close
```
Pierric replied