EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Using accented characters in Amazon S3 object names

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#37394
Posted: 08/08/2016 07:04:29
by Paolo Righi (Standard support level)
Joined: 02/15/2008
Posts: 34

Hi to all,

I faced a dilemma when I found out that Amazon S3 storage doesn't admit accented characters in the object names (keys).
What is the best solution in your opinion to get rid of that? Arise an error box to the user? Too simple. Propose an automatic rename? Or is there a smart possibility to manage these cases?
Thank you for your kind attention.

Paolo Righi.
C. H. Ostfeld
#37396
Posted: 08/08/2016 09:36:34
by Paolo Righi (Standard support level)
Joined: 02/15/2008
Posts: 34

Hi to all,

I forgot to specify that I'm using Delphi 2007 (with Ansi char) for the mantainance our application, while I'm using Delphi XE5 for developing new ones.
I have the issue on Delphi 2007, but I could compare the behaviour between the two versions of the AWS demo project.
I found out that on Delphi 2007 the function URLEncode behaves differently than on Delphi Xe5, converting accented characters to a different byte value.
I then replaced the
UTF8Src := BytesOfAnsiString(Data);
statement with the following
ConvertUTF16toUTF8(Data, UTF8Src, lenientConversion, false);
one to make the application work the same way on both environment.
Do you think it is right? Can I have any side effects?

Best regards.

Paolo Righi.
#37403
Posted: 08/09/2016 08:40:17
by Eugene Mayevski (EldoS Corp.)

BytesOfAnsiString() doesn't perform *any* conversion - it just moves the bytes (we use such functions instead of platform-native ways in order to maintain as little ifdef's within our code as possible, when targeting multiple platforms).

So you do need a proper UTF16-to-UTF8 conversion. And yes, your call is fine for this.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 260 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!