[PATCH] subreader: recode the whole file to utf-8 before parsing
Hi, this patch changes the way subtitle recoding takes place. Instead of recoding each 'struct subtitle', the whole file is read into memory, recoded to utf-8, and a stream is created with new_memory_stream. This patch was created as an attempt to resolve the problem with BOM in the beginning of a unicode subtitle file. The problem is not solved yet, but it is easy now, and will be done in a separate patch. As a side effect, which is arguably more important, it allows to read UTF-16 encoded subtitles. Subtitle related code at the beginning of subreader.c is unused now and can be removed. All in all, it seems like the right thing to do. Opinions ?
Hi, 2007/5/29, Evgeniy Stepanov <eugeni.stepanov@gmail.com>:
Hi,
this patch changes the way subtitle recoding takes place. Instead of recoding each 'struct subtitle', the whole file is read into memory, recoded to utf-8, and a stream is created with new_memory_stream.
This patch was created as an attempt to resolve the problem with BOM in the beginning of a unicode subtitle file. The problem is not solved yet, but it is easy now, and will be done in a separate patch. As a side effect, which is arguably more important, it allows to read UTF-16 encoded subtitles.
Subtitle related code at the beginning of subreader.c is unused now and can be removed.
All in all, it seems like the right thing to do. Opinions ?
I've tested your patch with enca and ucs-2le/ucs-2be encoded subtitles and it works great! Thanks! BTW is libass the right place to put the code? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
On Tuesday 29 May 2007, Zuxy Meng wrote:
Hi,
2007/5/29, Evgeniy Stepanov <eugeni.stepanov@gmail.com>:
Hi,
this patch changes the way subtitle recoding takes place. Instead of recoding each 'struct subtitle', the whole file is read into memory, recoded to utf-8, and a stream is created with new_memory_stream.
This patch was created as an attempt to resolve the problem with BOM in the beginning of a unicode subtitle file. The problem is not solved yet, but it is easy now, and will be done in a separate patch. As a side effect, which is arguably more important, it allows to read UTF-16 encoded subtitles.
Subtitle related code at the beginning of subreader.c is unused now and can be removed.
All in all, it seems like the right thing to do. Opinions ?
I've tested your patch with enca and ucs-2le/ucs-2be encoded subtitles and it works great! Thanks!
BTW is libass the right place to put the code?
The patch simply splits ass_read_file() in 2 functions, no new code is added to libass.
On Tuesday 29 May 2007, Evgeniy Stepanov wrote:
On Tuesday 29 May 2007, Zuxy Meng wrote:
Hi,
2007/5/29, Evgeniy Stepanov <eugeni.stepanov@gmail.com>:
Hi,
this patch changes the way subtitle recoding takes place. Instead of recoding each 'struct subtitle', the whole file is read into memory, recoded to utf-8, and a stream is created with new_memory_stream.
This patch was created as an attempt to resolve the problem with BOM in the beginning of a unicode subtitle file. The problem is not solved yet, but it is easy now, and will be done in a separate patch. As a side effect, which is arguably more important, it allows to read UTF-16 encoded subtitles.
Subtitle related code at the beginning of subreader.c is unused now and can be removed.
All in all, it seems like the right thing to do. Opinions ?
I've tested your patch with enca and ucs-2le/ucs-2be encoded subtitles and it works great! Thanks!
BTW is libass the right place to put the code?
The patch simply splits ass_read_file() in 2 functions, no new code is added to libass.
Applied.
participants (2)
-
Evgeniy Stepanov -
Zuxy Meng