问题描述
我有一个要转换为单字节ascii的unicode字符串.
fe ff 00 4d 00 61 00 69 00 6e 00 20 00 42 00 6f 00 61 00 72 00 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .B.o.a.r.d ........
我尝试使用此
size_t已转换= 0;
errno_t er = wcstombs_s(& converted,pL-> szName,64,(const wchar_t *)pLI-> szLayerName,_TRUNCATE);
但它返回错误EILSEQ.我尝试了其他几个版本,但没有任何效果.我想念什么?是开头的BOM(字节顺序标记)吗?
TIA
I have a unicode string that I would like to convert to single byte ascii.
fe ff 00 4d 00 61 00 69 00 6e 00 20 00 42 00 6f 00 61 00 72 00 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 þÿ.M.a.i.n. .B.o.a.r.d...........
I tried using this
size_t converted = 0;
errno_t er = wcstombs_s(&converted, pL->szName, 64, (const wchar_t *)pLI->szLayerName, _TRUNCATE);
but it returns an error EILSEQ. I tried a couple of other versions but nothing is working. What am I missing? Is it the BOM (byte order marker) at the beginning?
TIA
推荐答案
errno_t er = wcstombs_s(&converted, pL->szName, 64, (const wchar_t *)&pLI->szLayerName[2], _TRUNCATE);
错误EILSEQ
error EILSEQ
这篇关于wcstombs-用法-Unicode到ASCII的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!