rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: newbie on March 02, 2021, 08:10:55 PM

Title: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: newbie on March 02, 2021, 08:10:55 PM
Hi,
I am trying to create/view files and folders with utf-8 encoding. For e.g:
if I send the following curl cmd mkdir fails:
Quote
curl.exe -v -u user:password "http://localhost:280/data/Battlespaces/?mode=section&id=ajax.mkdir" --data "name=안녕"

As per this https://www.rejetto.com/wiki/index.php/HFS:_Template
Unicode support requires the following line in the tpl. It does in mine.
Quote
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

When I added a print-to-log line in the tpl in the mkdir script:
Quote
[ajax.mkdir|no log]
{.check session.}
{.set|x|{.postvar|name.}.}
{.add to log|"Test:{.^x.}".}
{.break|if={.pos|\|var=x.}{.pos|/|var=x.}|result=forbidden.}
{.break|if={.not|{.can mkdir.}.}|result=not authorized.}
{.set|x|{.force ansi|%folder%{.^x.}.}.}

It prints
Quote
Test:??

Also, doesnt the force ansi operation break utf-8 encoding?

Am I missing some other configuration setting?

Thanks
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: dj on March 03, 2021, 05:53:24 AM
welcome,

try hfs2.4 beta
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: danny on March 03, 2021, 02:54:51 PM
<style>body{font-family:"Arial Unicode MS","Lucida Sans Unicode","DejaVu Sans",sans-serif}</style>
It tells the client's browser to use windows, mac, linux, unicode fonts. 
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: newbie on March 03, 2021, 06:29:27 PM
Thanks for your responses DJ and Danny.

- Tried hfs2.4beta (2.4.0 RC6). Didnt make a difference.
- Also tried adding that style to the tpl. It too didnt make a difference.

In both 2.3m and 2.4.0 RC6, if I use the webUI's NewFolder button and copy/paste enter "안녕" in there, the response is that it Failed.
The logs print out my print statement like my original comment, printing:
Test:??
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: newbie on March 03, 2021, 06:44:19 PM
No....wait. I was wrong.
If I use my existing tpl HFS for some reason opened HFS with version:2.3m and it fails.
If I delete my tpl and restart HFS without it, the UI looks different and Korean characters are working.

So, this looks its working. I'll continue working w/ it, and come back w/ questions if I find anything odd.

Thanks all.
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: newbie on March 04, 2021, 12:26:17 AM
So creating a new folder from the webUI with Korean characters works just fine. And HFS even displays an existing folder w/ Korean chars.

However, when I try to create a folder using curl, it fails.
I tried:
Quote
curl.exe -v -u user:password "http://localhost:280/data/Battlespaces/?mode=section&id=ajax.mkdir" --data "name=안녕22"
Quote
curl.exe -v -u user:password "http://localhost:280/data/Battlespaces/?mode=section&id=ajax.mkdir" --data "name=안녕22" -H "Content-type: text/plain; charset=utf-8"

I printed out the value got from postvar|name in mkdir
Quote
[ajax.mkdir|no log]
{.check session.}
{.set|x|{.postvar|name.}.}
{.add to log|"Test:{.^x.}".}

For curl#1: The log prints "Test:??22"
For curl#2: The log prints "Test:"

I need similar support for curl for rename, deletion etc.

Does anyone have any suggestions?

Thank you in advance.
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: dj on March 04, 2021, 03:57:19 AM
it seems a problem of curl
searching in google I find:
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/curl-command-issue-with-special-characters/qaq-p/259276
untested

-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8"
Title: Re: Is utf-8 encoding supported? Chinese, Korean, Czech characters?
Post by: newbie on March 04, 2021, 03:14:21 PM
Curl cmds I've tried (and failed to get it to work)
Quote
curl.exe -v -u user:password "http://localhost:280/data/Blah/?mode=section&id=ajax.mkdir" --data "name=안녕22"
Quote
curl.exe -v -u user:password "http://localhost:280/data/Blah/?mode=section&id=ajax.mkdir" --data "name=안녕22" -H "Content-type: text/plain; charset=utf-8"
Quote
curl.exe -v -u user:password "http://localhost:280/data/Blah/?mode=section&id=ajax.mkdir" --data "name=안녕22" -H "Content-type: application/x-www-form-urlencoded; charset=utf-8"
Quote
curl.exe -v -u user:password "http://localhost:280/data/Blah/?mode=section&id=ajax.mkdir" --data-urlencode "name=안녕22" -H "Content-type: application/x-www-form-urlencoded; charset=utf-8"

I found that curl supports a trace option (--trace -) and I tried that
Quote
curl.exe -v -u user:password "http://localhost:280/data/Blah/?mode=section&id=ajax.mkdir" --data "name=안녕22" -H "Content-type: application/x-www-form-urlencoded; charset=utf-8" --trace -
And it does appear to be a curl issue. The data sent to HFS is bogus. See attached pic.