Using mex - get error "Unknown encoding 'cp1252"

3 ビュー (過去 30 日間)
Martin
Martin 2012 年 7 月 31 日
Hi, i want to use the mex-functions. By calling "mex -setup" or other mex-functions i get the error Unknown encoding 'cp1252. Debugging and tracing the mex-files shows an error code 255 of DOS. The error occurs in line 176 (DOS-Output in file: mexutils.pm). I'm using WinXPx86 SP3 with MSVS 2010.
Is there any solution for this error?
Thanks!
  2 件のコメント
Martin B
Martin B 2012 年 7 月 31 日
I got the exact same error message today. Hope somebody is able to help here.
Thanks a lot.
Christoph
Christoph 2012 年 8 月 3 日
this is quite wired and frustrating...got this error today, too. I don't have any clue how to elimanate this error or how to work around. Did anyone solved this error?
Kind regards, CN

サインインしてコメントする。

採用された回答

Martin B
Martin B 2012 年 8 月 3 日
Hi there,
my colleague and me just figured out how to "hard code" a workaround for this. As Martin already mentioned, the error occurs in the perl script "mexutilx.pm". It tries to use the perl function "decode" to decode with the "cp1252" codepage. Unfortunately this fails. Aftwerwards we thought: "Who needs decoding?", and disabled it. And it acutally works in my case.
So without any warranty:
Just place
$encoding = 0;
at line 148 in the mexutilx.pm file to make sure that the following
if ($encoding)
{
...
} else {
...
}
is not "true"! It worked in my case, although it might break if some c/c++ functions use things like ä,ö,ü....
And make sure that you copy the "mexutilx.pm" just to be able to restore to the old state.
Just one question: Can it be that both of use mex at work and is this workplace by any chance at a big german company?
Best regards, Martin
  2 件のコメント
Martin
Martin 2012 年 8 月 3 日
Hi,
thanks a lot. Works fine!
Maybe ;-)
Best regards, Martin
Christoph
Christoph 2012 年 8 月 6 日
Hi Martin B.,
thanks for your great work. I tried your workaround a few minutes ago and until now it works pretty well. i recognized just one small differece: at my Matlab-Version (32bit, R2012b) the Perl Script is called mexutils.pm
Nevertheless great work,
kind reagrds, CN

サインインしてコメントする。

その他の回答 (1 件)

Tobias
Tobias 2013 年 6 月 4 日
Hello, I have a similar problem. When calling "mex -setup", I get the same error message Unknown encoding 'cp1252 ' refering to mexutils.pm line 176. I'm also using WinXP 32Bit, SP3 and Matlab 2013b. Unfortunately Martins solution didn't work for me. I appreciate any help, advice etc.
Thanks in advance!
  1 件のコメント
Tobias
Tobias 2013 年 6 月 4 日
*solved
It seems that Matlab2013a has not the exact same mexutils.pm file. obviously i had to put $encoding = 0; several lines below...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by