Hi All,
In Web API, when Appian receives file in binary format, we are using Appian-Document-Name field in the header to pass file name. And it is working fine when for English characters but when comes to Swedish file names it gives random some values in the file name.
For Example, Expected file name ÖPPNA.pdf, actual output cames ?PPNA.pdf
Discussion posts and replies are publicly visible
How do you encode that filename in the header? Ist that valid UTF8?
Passed Content-Type header as application/json; charset=utf-8 but still it showing ? for Swedish characters in file name
You can pass any header you want, but as long as the actual character encoding is not correct, any special characters will get messed up.
Now I understood, you are referring to Appian-Document-Name header where we are passing file name it should to be encode with UTF-8 then Appian will detect properly. Am I correct?
Correct.
Thanks for the quick solution. One question, to test this scenario tried to pass encoded file name using Appian function htmlencode() and urlencode(), for both option it sent to appian in encoded way and stored in database but decode not happened automatically. Whether we have write decode function while storing in DB?
Not sure what you mean. URL encoding is something completely different than charset encoding. A quick AI generated explanation:
Charset Encoding vs URL Encoding: A Key Difference
In the world of web development, two important concepts are often confused with each other: charset encoding and URL encoding. While both deal with text data, they serve distinct purposes.
Purpose: Define how characters in a document or message should be interpreted by the recipient's system.
Example Use Case: When sending an email from one mail client to another across different systems and languages, charset encoding ensures that special characters like accents are correctly displayed on both ends.
Common Charset Encodings:
In HTML documents, the meta tag is often used to specify the character set:
<meta charset="UTF-8">
2. URL Encoding (Query String)
Purpose: Convert special characters in a query string into safe bytes that can be transmitted over HTTP.
Example Use Case: When sending data from an HTML form or API request, URL encoding ensures that spaces and other non-alphanumeric characters are properly encoded so they don't interfere with the transmission process.
Common URL Encodings:
In URLs, special characters like spaces (%20) or ampersands (&) need to be replaced:
GET /path/to/resource?param1=value¶m2=another+value HTTP/1.1
Key differences:
In summary, charset encoding ensures correct interpretation of text data across different systems and languages, while URL encoding ensures that special characters are properly encoded when sending data via URLs.
When I passed value in header in charset encoded format it is working fine. Thanks for the support