EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Using accented characters in Box storage object names

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#37398
Posted: 08/08/2016 11:16:21
by Paolo Righi (Standard support level)
Joined: 02/15/2008
Posts: 34

Dear support,

I tried to upload a file whose name contains accented characters.
What I get is an object with a name like this:
=?utf-8?b?QmlsZF9mw7xyX1dvcmQuanBn?=
If I change the PerformPost function call replacing the Filename parameter with URLEncode(Filename) expression then the file name is like the original but with accented characters replaced by the "%xx%xx" format.
Can this be solved in some way?
Thanks.

Best Regards.
Paolo Righi.
#37402
Posted: 08/09/2016 08:38:33
by Eugene Mayevski (EldoS Corp.)

Try to encode filenames with UTF8 yourself before uploading, then they won't be converted.


Sincerely yours
Eugene Mayevski
#37421
Posted: 08/10/2016 07:02:39
by Paolo Righi (Standard support level)
Joined: 02/15/2008
Posts: 34

Hi Eugene,

thank you for your answer.
In the meanwhile I found a working solution.
I changed the TElHTTPSClient.EncodeFieldValue to convert to UTF8 this way:

function TElHTTPSClient.EncodeFieldValue(const Value: string; const Charset : string): string;
...
begin
...
if not NeedsEncoding then
Result := Value
else
begin
ConvertUTF16toUTF8(Value, Tmp, lenientConversion, false); <<
Result := StringOfBytes(Tmp); <<
Exit; <<
{$ifdef SB_ANSI_VCL}

What do you think?

Best regards.
Paolo Righi.
#37432
Posted: 08/10/2016 17:49:28
by Eugene Mayevski (EldoS Corp.)

Altering the source code can lead to unpredictable bugs in other scenarios.

Unfortunately it's not clear from your messages, what (unicode or non-unicode) strings you manipulate in this case, and, consequently, it's not clear, why (and if correctly) the name is converted.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 288 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!