22 Jul 2012 23:29
unicode troubles
Hi all.
I'm using the latest release of ecl - 12.7.1. The question
may be not about the ecl at all. But there a misunderstanding: what
encoding ecl uses by default during conversation between lisp and c? The
nice project http://createuniverses.blogspot.com/2009/09/qtimagine-skeleton-project-for-live.html doesn't works on ecl with enabled unicode support, because the code
cl_object princed = cl_princ_to_string(output); // output was "No error" for example
std::string outStr = (char*)princed->base_string.
self; //outStr is just "N" now
become wrong, and base_string.self currently contains a pointer to a wchar_t 32-bit unicode string. (Is there any way to generate simple 8-bit ASCII string from cl_objects?)
I tried to use QString to convert wchar_t* into std::string: QString::fromWCharArray((wchar_t*)princed->base_string.self).toStdString() but it doesn't work because, the string turned out not to be null-terminated. An it puls a lot of garbege from memory. How should i properly handle this strings? What is the most convinient way to convert cl_obects into strings?
Furthermore, as an input string it requires an ASCII char* pointer, and provided unicode one it fails(it just reads only the first symbol, because it is followed by 3 nulls: L"(print 1)" -> "(\000\000\000p\000\000\000...").
It looks quite wired: inputing from char*, and outputing to wchar_t* and only in this way.
The version with disabled unicode support first goes to fail on Windows7x64 with: Unsupported external format: latin-1. Does any one know which code page can be accepted and worked with?
become wrong, and base_string.self currently contains a pointer to a wchar_t 32-bit unicode string. (Is there any way to generate simple 8-bit ASCII string from cl_objects?)
I tried to use QString to convert wchar_t* into std::string: QString::fromWCharArray((wchar_t*)princed->base_string.self).toStdString() but it doesn't work because, the string turned out not to be null-terminated. An it puls a lot of garbege from memory. How should i properly handle this strings? What is the most convinient way to convert cl_obects into strings?
Furthermore, as an input string it requires an ASCII char* pointer, and provided unicode one it fails(it just reads only the first symbol, because it is followed by 3 nulls: L"(print 1)" -> "(\000\000\000p\000\000\000...").
It looks quite wired: inputing from char*, and outputing to wchar_t* and only in this way.
The version with disabled unicode support first goes to fail on Windows7x64 with: Unsupported external format: latin-1. Does any one know which code page can be accepted and worked with?
--
Necto.
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Ecls-list mailing list Ecls-list@... https://lists.sourceforge.net/lists/listinfo/ecls-list
RSS Feed