diff options
| author | Sam Varshavchik | 2014-06-02 23:48:11 -0400 | 
|---|---|---|
| committer | Sam Varshavchik | 2014-06-02 23:48:11 -0400 | 
| commit | b5c79832f0aad2e51f493854a24d34a513d77292 (patch) | |
| tree | 31e3be5c17a9478415fa55bb8b3e2e156a5f5dbd /unicode/linebreaktest.C | |
| parent | 85fef2950d04d309555478ed3828cc0a01b28a09 (diff) | |
| download | courier-libs-b5c79832f0aad2e51f493854a24d34a513d77292.tar.bz2 | |
courier-unicode: unicode::iconvert::fromu::convert() change.
Return an error indication if unicode could not be converted to the
requested character set.
Diffstat (limited to 'unicode/linebreaktest.C')
| -rw-r--r-- | unicode/linebreaktest.C | 29 | 
1 files changed, 27 insertions, 2 deletions
| diff --git a/unicode/linebreaktest.C b/unicode/linebreaktest.C index 0d1dffe..abaa922 100644 --- a/unicode/linebreaktest.C +++ b/unicode/linebreaktest.C @@ -202,13 +202,38 @@ int main(int argc, char **argv)  		exit(1);  	} -	if (unicode::iconvert::fromu::convert(uc.first, "utf-8") != convteststr) +	std::pair<std::string, bool> +		ret=unicode::iconvert::fromu::convert(uc.first, "utf-8"); + +	if (ret.first != convteststr || ret.second) +	{ +		std::cerr << "unicode::iconvert::fromu::convert failed (1)" +			  << std::endl; +		exit(1); +	} + +	uc.first.clear(); +	uc.first.push_back(0x30A2); + +	if (!unicode::iconvert::fromu::convert(uc.first, "iso-8859-1") +	    .second)  	{ -		std::cerr << "unicode::iconvert::fromu::convert failed" +		std::cerr << "unicode::iconvert::fromu::convert failed (2)"  			  << std::endl;  		exit(1);  	} +	uc.first[0]=160; + +	if (unicode::iconvert::fromu::convert(uc.first, "iso-8859-1") +	    .second) +	{ +		std::cerr << "unicode::iconvert::fromu::convert failed (3)" +			  << std::endl; +		exit(1); +	} + +  	uc=unicode::iconvert::tou::convert("\xE3", "utf-8");  	if (!uc.second) | 
