Re: Converting WideChar/WideString to AnsiChar/AnsiString



ckoegl пишет:

Ok, in my case I simply cannot dodge the problem: I have (for
whatever reasons) text data given as WideString and I need to call
given procedures/functions that only accept String (which in my case
means AnsiString). It is entirely acceptable that some data ist lost
during the WideString to String conversion, but: (1) All character
information that can be transferred should be transferred, and (2) I
need to know quite exactly what happens in case unconvertible
character data is encountered.


In the case these functions doesn't operate with the outer world (pure string processing) you can probably use UTF-8.

--
If you want to get to the top, you have to start at the bottom
.



Relevant Pages

  • Re: problem casting from variant to string
    ... Queensland and the power grid is about to collapse. ... Casting a WideString to PWideChar is the same as ... >> string length is then taken to include everything up to the final null, ... > null characters would mean that the length stored in the OleVariant ...
    (comp.lang.pascal.delphi.misc)
  • Re: Voting for FastCode rules on memory reading
    ... > least one byte of a ShortString, PChar, AnsiString or WideString ... > string, including a #0 terminator. ...
    (borland.public.delphi.language.basm)
  • Re: Suggested Alternative Unicode Implementation (for Rudy+ miscothers)
    ... AnsiString in your old software. ... in crippled strings. ... The default string is NOT going to be WideString, but UnicodeString, ...
    (borland.public.delphi.non-technical)
  • Re: Unicode in Delphi/VCL (yet again)
    ... The problem is how does .AsString or .Text know when to handle it as an ANSI and when to handle it as UNICODE? ... What about the performance of WideString vs String? ... This made the conversion smoother too ...
    (borland.public.delphi.non-technical)
  • Re: D2009 - String = WideString?
    ... So würdest du aber nur den halben String ... oder garnicht funktionieren. ... Der westliche WideString ist bestimmt aus performance-Gründen gestutzt. ... Messungen/Beispielen illustrieren da es sonst nur eben eine Behauptung ...
    (de.comp.lang.delphi.misc)