bugCompact Disc Input and Control Library - Bugs: bug #53929, cd-text with invalid characters...

 
 

bug #53929: cd-text with invalid characters failing to convert to utf8

Submitted by:  Serge Pouliquen <sp31415>
Submitted on:  Thu 17 May 2018 12:40:28 PM UTC  
 
Category:  None Severity:  5 - Average
Item Group:  cd-info Status:  In Progress
Privacy:  Public Assigned to:  Rocky Bernstein <rocky>
Open/Closed:  Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 18 May 2018 09:55:42 AM UTC, comment #3:

This patch has been applied to the serge-cdtext branch.

Some small logic improvements have been applied.

I haven't tested it. In fact, it would be great if you could add a test case for it.

Your patch pasted as text didn't apply automatically, so please review the change.

In the future please don't cut and paste patch but instead either upload the patch, use use git-format-patch or fork the code and point to that. Thanks

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Thu 17 May 2018 01:10:26 PM UTC, comment #2:

Many thanks!

When I get a chance, I will make a git branch
with these changes so that others can comment on them. (I have not looked in detail at it yet.)

Unless there are objections, that branch will be merged in.

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Thu 17 May 2018 01:09:03 PM UTC, comment #1:

Many thanks!

When I get a chance, I will make a git branch
with these changes so that others can comment on them. (I have not looked in detail at it yet.)

Unless there are objections, that branch will be merged in.

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Thu 17 May 2018 12:40:28 PM UTC, original submission:

Hi,

my cd text is containing bad characters and convertion to utf8 is failing

I attached cd-toc from cdrdao

I propose to check error returned during utf8 convertion.
In case of error, the read value from cd wil be used without any convertion. In my case, only one character was useless instead of the whole line to be absent.
I don't know if it's a good idea to add that fallback mode...

+++ b/lib/driver/cdtext.c
@@ -501,9 +503,14 @@ cdtext_set(cdtext_t p_cdtext, cdtext_field_t key, const uint8_t value,
/* recode to UTF-8 */
if (NULL != charset) {
cdio_utf8_t *utf8_str = NULL;
- cdio_charset_to_utf8((const char*) value, strlen((const char*)value),
+ bool retval;
+ retval = cdio_charset_to_utf8((const char*) value, strlen((const char*)value),
&utf8_str, charset);
- p_cdtext->block[p_cdtext->block_i].track[track].field[key] = (char *)utf8_str;
+ if (1 == retval) {
+ p_cdtext->block[p_cdtext->block_i].track[track].field[key] = (char *)utf8_str;
+ } else {
+ p_cdtext->block[p_cdtext->block_i].track[track].field[key] = strdup((const char *)value);
+ }
} else
p_cdtext->block[p_cdtext->block_i].track[track].field[key] = strdup((const char *)value);
}

Regards,

Serge Pouliquen <sp31415>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44171:  toc-file-starmania.toc added by sp31415 (5KiB - application/x-cdrdao-toc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rocky (Posted a comment)
  • -email is unavailable- added by sp31415 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-18 rocky StatusNone => In Progress
    2018-05-17 rocky Assigned toNone => rocky
    2018-05-17 sp31415 Attached File- => Added toc-file-starmania.toc, #44171

    Back to the top


    Powered by Savane 3.3