[Date Prev][Date Next]
RE: String conversions UTF8 <-> ISO-8859-1
> I rather not try to solve the complete problem. I don't think we can.
Definitly not, just think about conversions from UTF-8 to ASCII in BSTR
format (string format used in COM and VisualBasic).
> I think we actually agree that we should provide some "help"
> to application developers who need to do "conversions". I
> think we just disagree over the choice of the API mechanism
> to use to provide that "help".
In my opinion the provided "help" has to be template based to be type
Taken the case of UTF-8 to ASCII-BSTR we not only have to do the
conversion we also have a different type to return. The OpenLDAP library
API now works with const char* or char*, which makes sense, but BSTR's
are wchar_t* at the end. Additionaly, memory for a BSTR has to be
(de)allocated with special OS functions.
Thus, the best way to solve the conversion problem is the one you
mentioned with having a second API doing all the conversion stuff and
simply calling the LDAP API. The second API has to be template based to
specify the type to use for strings on the application side and don't
forget, that the API has to support special string memory
> If we go with callbacks, un/repacking of BER is exactly what
> we'll be doing. If we just provide helpers, the application
> can do conversion where they normally do value extraction and
> hence avoid repacking.
My opinion too. Again, with callbacks we are not able to support
conversions like UTF-8 <-> ASCII-BSTR or UTF-8 <-> Unicode-ASCII,
because, as e.g., the type returned by ldap_get_values() is char**.
Thus, callbacks do not solve the problem at all it just has more string
copies as a consequence.