rejetto forum
Software => HFS ~ HTTP File Server => Topic started 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:
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.
<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:
[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 Test:??
Also, doesnt the force ansi operation break utf-8 encoding?
Am I missing some other configuration setting?
Thanks
-
welcome,
try hfs2.4 beta
-
<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.
-
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:??
-
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.
-
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:
curl.exe -v -u user:password "http://localhost:280/data/Battlespaces/?mode=section&id=ajax.mkdir" --data "name=안녕22"
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
[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.
-
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"
-
Curl cmds I've tried (and failed to get it to work)
curl.exe -v -u user:password "http://localhost:280/data/Blah/?mode=section&id=ajax.mkdir" --data "name=안녕22"
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"
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"
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
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.