언어 설정

Menu
Sites
Language
Converting String to ByteBuffer*

which is the best way to convert String to ByteBuffer*

 

Responses

6 댓글
Alex Ashirov

Hi,

Please take a look at the Tizen::Base::Utility::StringUtil class:

https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.native.apireference%2FclassTizen_1_1Base_1_1Utility_1_1StringUtil.html

harish kumar kavali

i had already seen that my doubt is whether to use 

static ByteBuffer * 

DecodeBase64StringN (const String &base64String)

or

static ByteBuffer *  StringToUtf8N (const String &unicodeString)
Alex Ashirov

Hi,

This depends on type of data containing in your string. The following link provides some examples of possible conversions:

https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.native.appprogramming%2Fhtml%2Fguide%2Fbase%2Fstring.htm

Chintan Gandhi

Hi Harish,

static ByteBuffer *  StringToUtf8N (const String &unicodeString) is used to encode Unicode strings to byte sequences.

static ByteBuffer * 

DecodeBase64StringN (const String &base64String)

is used to encode a byte sequence to a string.

So, these are widely different concepts and should not be confused.

Things to keep in mind:

Not every byte sequence represents an Unicode string encoded in UTF-8 or UTF-16.

Not every Unicode string represents a byte sequence encoded in Base64.

Thus if your string contains byte sequences [A-Z] then you should use first option or else second.

 

Thanks.

harish kumar kavali

thanks for ur datiled explaination

Chintan Gandhi

Pleasure.