Re: A little help with phix - please

new topic     » goto parent     » topic index » view thread      » older message » newer message

try using utf16_to_utf8().

I cannot offhand say why it works transparently on OE but not on phix. It may be an OS-specific console setup thing (are you on windows or linux?). Perhaps if you show me the output of say:

sequence text = GetDocumentText(docHandle)  
--/**/ ? text&-1 
--/**/ text = utf16_to_utf8(text) -- (not needed on OE) 
--/**/ ? text&-1 
puts(1, text) 

I may be able to shed some more light. (The above is written so that OE ignores the middle three lines but phix does not, and the &-1 forces output as integers rather than chars.)
If text is rather big, perhaps you could do something like text = text[240..260] to trim it down to the first place it goes wrong.
I should also say that utf16_to_utf8() may terminate in error if passed an 8-bit string.

Incidentally, you may fare slightly better by hiding the OE includes from phix as follows:

--/* 
include std/dll.e  
include std/machine.e  
include std/math.e  
--*/ 

In the particular case of peek_wstring() from std/machine.e you are probably fine, but several std/ routines (ie OE standard includes) may not work on phix.
You can always ask me to add an equivalent to builtins of any routine in std that you regularly use, though since last time I checked there were about 500 of them, I reserve the right to say no smile

Regards, Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu