Skip to content

Commit

Permalink
Merge pull request #2165 from xiaoyifang/fix/stardict-sametypesequenc…
Browse files Browse the repository at this point in the history
…e-invalid

fix:newline character contained in the string
  • Loading branch information
xiaoyifang authored Feb 17, 2025
2 parents d63f81a + 78c9c92 commit 1f8ab0e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dict/stardict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ string StardictDictionary::loadString( size_t size )

idx.read( &data.front(), data.size() );

return string( &data.front(), data.size() );
string result( &data.front(), data.size() );
//trim the string
result.erase( result.find_last_not_of( " \n\r\t" ) + 1 );
result.erase( 0, result.find_first_not_of( " \n\r\t" ) );

return result;
}

void StardictDictionary::getArticleProps( uint32_t articleAddress,
Expand Down

0 comments on commit 1f8ab0e

Please sign in to comment.