Arno, > The only workaround that comes to my mind was another overload that takes > a RawByteString instead of string. I won't use AnsiString because implicit > ansi string > casts must be avoided too.
That would work for me. I'm not very familiar with the use of RawByteString, but I made version of the function that works for me, do you think this version would work for others too (I just testet in 2010 C++ builder): Regards Bjørnar Code follows (only change from previous version I sent is type-change of first in-param): function UrlDecode(const S : RawByteString ; SrcCodePage: Cardinal = CP_ACP; DetectUtf8: Boolean = TRUE) : UnicodeString ; var I, J, L : Integer; U8Str : AnsiString; Ch : AnsiChar; begin L := Length(S); SetLength(U8Str, L); I := 1; J := 0; while (I <= L) and (S[I] <> '&') do begin Ch := AnsiChar(S[I]); if Ch = '%' then begin Ch := AnsiChar(htoi2(PAnsiChar(@S[I + 1]))); Inc(I, 2); end else if Ch = '+' then Ch := ' '; Inc(J); U8Str[J] := Ch; Inc(I); end; SetLength(U8Str, J); if (SrcCodePage = CP_UTF8) or (DetectUtf8 and IsUtf8Valid(U8Str)) then {$IFDEF COMPILER12_UP} Result := Utf8ToStringW(U8Str) else Result := AnsiToUnicode(U8Str, SrcCodePage); {$ELSE} Result := Utf8ToStringA(U8Str) else Result := U8Str; {$ENDIF} end; -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be