fatmanverse opened a new issue, #12918:
URL: https://github.com/apache/seatunnel/issues/12918

   ### Search before asking
   
   - [x] I had searched in the issues and found no similar issues.
   
   ### What happened
   
   The REST API v2 decodes a request body as ISO-8859-1 when the `Content-Type` 
has no `charset`, so non-ASCII text in a HOCON, SQL or JSON job config is 
silently garbled. Only `application/json` is read as UTF-8 without an explicit 
charset.
   
   `BaseServlet#requestBody` reads the body with 
`HttpServletRequest#getReader()`, which uses the request character encoding and 
falls back to the servlet default ISO-8859-1. The job is submitted and runs 
with the corrupted values; nothing reports an error. The upload endpoint is not 
affected, because `SubmitJobByUploadFileServlet` decodes the file part as UTF-8 
explicitly.
   
   Measured on `dev` e2957d2 with `job.name = "中文作业"` in the body:
   
   | endpoint | body | Content-Type | job name |
   | --- | --- | --- | --- |
   | `/submit-job?format=hocon` | HOCON | `text/plain` | `中æä½ä¸` |
   | `/submit-job?format=hocon` | HOCON | `text/plain; charset=UTF-8` | `中文作业` |
   | `/submit-job` | JSON | `application/json` | `中文作业` |
   | `/submit-jobs` | JSON | `application/json` | `中文作业` |
   | `/submit-jobs` | JSON | `text/plain` | `中æä½ä¸` |
   
   #5860 fixed the job name in the query string of the old Hazelcast REST 
endpoint; this is the request body of the v2 endpoints. The same applies to 
every value in the config, for example a Chinese table name, a filter literal 
in a SQL transform query, or a path.
   
   ### Expected behavior
   
   A body without a declared charset is read as UTF-8. JSON is UTF-8 by 
definition (RFC 8259), and HOCON and SeaTunnel SQL files are UTF-8, which is 
also how the upload endpoint and the CLI read them.
   
   ### SeaTunnel Version
   
   dev (3.0.1-SNAPSHOT, e2957d2)
   
   ### Zeta or Flink or Spark Version
   
   Zeta
   
   ### Java or Scala Version
   
   JDK 11
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to