So far i can get riddof em by adding a "end tag" at the end of string at nodejs and stripping the wstring at FB.
Code: Select all
' freebasic library
#cmdline "-dll"
#include "fbgfx.bi"
#define endOfStringTag "[@@@]"
function trim_endTag(s as string) as string
declare function fb_println cdecl alias "fb_println" (s as wstring) as boolean
function trim_endTag(s as string) as string
return mid(s, 1, (instr(s, endOfStringTag))-1)
end function
function fb_println cdecl alias "fb_println" (s as wstring) as boolean export
print trim_endTag(s)
return true
end function
Code: Select all
// nodejs script
/* fb-lib expects wstrings, not regular strings so here is function to handle em.
"" are added at front of string incase the parameter is number, not a string */
function wstring(fb_string) {
fb_string = fb_string + "[@@@]";
return iconv.encode(fb_string, "utf32-le");
}
Im sure there is some more elegant way to do this, but if i dont use that endOfStringTag and strip string, my output looks horrible:
1缱缱
2缱缱
3搙����
4
5搙搙���A
6𰸂A
7Ʃ搙����A
8搙
9搙搙搙A
10����������������A