[fpc-pascal] Assigning string constant to a WideString and the Format function

Michael Van Canneyt michael at freepascal.org
Wed Dec 23 11:59:38 CET 2015



On Wed, 23 Dec 2015, Lubos Pintes wrote:

> Hello Mark,
> The result isthe same, I tried it before I wrote my message.
> I even tried to temporarily write ordinal codes of characters, it seems 
> that a string is not automatically converted to a WideString when 
> assigned, there wereno zeros, like H#0e#0l#0, etc.

Did you try
WideStr := Format(WideString('<pitch absmiddle="%d">%s</pitch>'), [Pitch, Text]);
to make sure the correct function is used ?

Michael.
>
> Dňa 23. 12. 2015 o 11:07 Mark Morgan Lloyd napísal(a):
>> Lubos Pintes wrote:
>>> Hello,
>>> I have a text in the WideString variable. I want to send this text to
>>> a SAPI5 synthesizer. I am doing this as follows:
>>> WideStr := Format('<pitch absmiddle="%d">%s</pitch>', [Pitch, Text]);
>>> Pitch is integer, Text is WideString.
>>> The result is incorrect, only a half of the Text contents is copied to
>>> the result.
>>> Tested with Free Pascal Compiler version 3.1.1 [2015/11/14] for i386
>>> Thanks
>>
>> What happens if the format string is put into a temporary widestring?
>>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list