Pelles C forum

Pelles C => Bug reports => Topic started by: BlueD on October 31, 2010, 03:44:53 AM

Title: mbstowcs and getwline
Post by: BlueD on October 31, 2010, 03:44:53 AM
I cannot use mbstowcs(and mblen, mbtowc, etc.) to convert Chinese strings.
Is it a bug or missing feasure?

Pelles C 6.50 RC2:

Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <locale.h>

int main(void)
{
  const char *str = "大家好!";
  wchar_t wstr[100];

  setlocale(LC_ALL, "CN");
  if (mbstowcs(wstr, str, 99) != -1)
    wprintf(L"%ls\n", wstr);
  else
    wprintf(L"Error: cannot convert the string!\n");
  
  return 0;
}

And I think getwline doesn't work too, see here (http://forum.pellesc.de/index.php?topic=3357.0)

Actually I think most functions about multibytes are not working properly.
Title: Re: mbstowcs and getwline
Post by: Pelle on November 04, 2010, 06:14:48 PM
Supporting Chinese has never been a priority, and I'm pretty sure it never will be.
I don't understand Chinese, I don't know what is needed to support it, and I don't have sufficient fundings to bother... sorry...
Title: Re: mbstowcs and getwline
Post by: Stefan Pendl on November 04, 2010, 07:59:18 PM
Use wchar_t instead of char is the first I would do.

Unicode strings are of type wchar_t, only ANSI strings are of type char.

Code: [Select]
const wchar_t *str = L"大家好!";
Title: Re: mbstowcs and getwline
Post by: BlueD on November 05, 2010, 03:40:07 AM
Supporting Chinese has never been a priority, and I'm pretty sure it never will be.
I don't understand Chinese, I don't know what is needed to support it, and I don't have sufficient fundings to bother... sorry...

What a great statement!
You really should put this on you frontpage, then people like me won't be stupid enough to use your software.

"Pelles C -- Only for western developers!"
Title: Re: mbstowcs and getwline
Post by: frankie on November 05, 2010, 10:09:37 AM
亲爱的BlueD,
我认为Pelle不会粗鲁,但要指出,他的主要兴趣是编译器的开发。他没有足够的时间去工作,具体问题不同的语言也。
正如您可以看到IDE的消息翻译工作都是由志愿者。
反正你的问题是由于widechar程序比从编译器更多。
在我的身边总是欢迎。

Dear BlueD,
I think that Pelle would not be rude, but would point out that his main interest is in compiler development. He don't have enough time to work also on issues specific to different languages.
As you can see the IDE message translations are done by volunteers.
Anyway the problems you have are due to the widechar routines more than from the compiler.
On my side you are always welcome.
Title: Re: mbstowcs and getwline
Post by: Pelle on November 19, 2010, 04:59:43 PM
What a great statement!
You really should put this on you frontpage, then people like me won't be stupid enough to use your software.

"Pelles C -- Only for western developers!"
People as stupid as you wouldn't read that text anyway, so what's the point...??!!
Title: Re: mbstowcs and getwline
Post by: top398 on April 08, 2014, 05:13:38 PM
I encounted the same sitution. But at least, under windows, there is a pair of APIs: WideCharToMultiByte and MultiByteToWideChar, so problem is partial solved.

But all in all, please as far as possible to improve mbstowcs / wcstombs and others wchar_t function.

By the way: Pelle's C compiler is really very small, very easy to use.