Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
[BUG]The recently svn version(138xx ~ ) can not decode Chinese subtitle correctly
#1
I compiled svn code in XP with VC 2008 express. when I use it to play video, I find that the Chinese subtitle can't display. In log file, it says:

16:28:01 T:3664 M:371625984 ERROR: CCharsetConverter::convert failed
16:28:01 T:3664 M:371625984 ERROR: CCharsetConverter::convert failed

The linux version can decode correctly.
Reply
#2
We need the full debug log (pastebin) and a short example file to reproduce it.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
Yeah, I update the full log file and subtitle file to the place:
http://rapidshare.com/files/126510949/xbmc.tar.gz.html
BTW, If I use English GUI, the subtitle display with strange char because of without rigth font, but when I change the gui language to chinese, the subtitle can 't display. I traced the code, it seems that something wrong in xbmc/utils/CharsetConverter.cpp, but it work will in linux.
Reply
#4
I traced the program again, and find something intersting. the function "libiconv_t" always returns empty string.It seems that the main program can not call the fuction in the static lib "libiconv" or the libiconv can't work well. I guess there is something worng between the libiconv, the file"iconv.h", the file "CharsetConverter.h" and the find "CharsetConverter.cpp". I hope these will help to find out the problem.
Reply
#5
Question 
Which TTF font are you using? Currently you manually have to replace arial.ttf with arialuni.ttf (arialuni.ttf does not come with XBMC but it comes with all Microsoft Windows operating-systems so search).
http://wiki.xbmc.org/?title=Fonts

Hopefully in the future XBMC for Windows will be able to take advantage of the fonts that come with the operating-systems direcly by default without the user having to copy or rename the files (PLEX, formerly OSXBMC, has added a such function to their Mac OS X port of XBMC).

Rolleyes
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#6
I used a font combine with the YaHei font come from vista and the font MS Consolas so I can dispalyer the Chinese char and English char well. I replace the /Media/Font/arial.ttf with it. I am confused that it can show chinese char at UI, but can't show it in subtitle. I know there is some issue about this font, but I just use in myself. I copy from windows/fonts dir.
Reply
#7
At last I found what was happened in the program. In xbmc/utils/CharsetConverter.cpp, it use the fuction CCharsetConverter::wToUTF8 to convert the UTF-16LE to UTF-8 encode, but in windows xp, the sizeof(wchar_t) return 2 rather then 4, so the iconv->convert functun can not work right. Just change line 319 in CharsetConverter.cpp from:

convert(m_iconvWtoUtf8,sizeof(wchar_t),WCHAR_CHARSET,"UTF-8",strSource,strDest);

to:

#if defined(_XBOX) || defined(WIN32)
convert(m_iconvWtoUtf8,sizeof(wchar_t) * 2,WCHAR_CHARSET,"UTF-8",strSource,strDest);
#else
convert(m_iconvWtoUtf8,sizeof(wchar_t),WCHAR_CHARSET,"UTF-8",strSource,strDest);
#endif

will worked perfectly. I am not sure if the sizeof(wchar_t) in other place should change.

I don't know how to submit the patch to the developer term. The sourceforge's tracker can access know.
Reply
#8
Thanks for the detailed report. The question is if we can do the change for all conversation routines? What I don't get is when windows defines wchar_t as 2 bytes why do we have to increase it to 4 bytes since we're on windows?
Also I read somewhere that windows uses utf-16 and most Linux OS utf-32 so what does this have to do with utf-8?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#9
Multiplier IMO should be 6 in both cases. The multiplier is used for the number of bytes that the destination charset could potentially use. It's computed as the length of the input string (in characters, not bytes) times the multiplier.

UTF-8 can potentially use 6 bytes per character (in most cases it'll use 4 or less though). Setting the multiplier to sizeof(wchar_t) is certainly incorrect as this has nothing to do with the output charset of utf8. The reason it fails on win32 with chinese is because it's essentially using a multiplier of 2 which doesn't allocate enough bytes for the conversion.

Solution: Change anything that outputs in UTF8 to use 6.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
I think using "sizeof(WCHAR_CHARSET)" is better solution then "sizeof( wchar_t) *2" since it has defined in CharsetConverter.h in different os.
Reply
#11
Yeah, but if you read my post that's plain wrong as well Wink WiSo has made the changes to fix things up to use 6 bytes/char for utf8 like it should be.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#12
Sorry I might be dense but, I am also having this problem on rev 13859 and I tried to follow kazuyuki fix but I can't find the utils folder\file under C:\Program Files\XBMC\ . I know this will be fixed but my wife hates MCE and is driving me crazy to get XBMC working and that's the only thing left to fix. Anyt help would be greatly appreciated.
Cheers
treefour
Asus Essentio CS5110, Intel E8300, 2 GB Ram, 8600M GT
Reply
#13
You will have to wait for a new win32 release or compile yourself (which will probably not be worth the trouble, especially if you use kazuyukis fix, which is more of a workaround than a fix, because it is apparantly also using the wrong logic).
Reply
#14
Cheers thanks for that there just happen to be a new release today Nod Thanks for the reply
Cheers
Asus Essentio CS5110, Intel E8300, 2 GB Ram, 8600M GT
Reply

Logout Mark Read Team Forum Stats Members Help
[BUG]The recently svn version(138xx ~ ) can not decode Chinese subtitle correctly0