When I create a csv file through java then for name "Men's Commemorative ® ELITE Bib Short", it is storing "Men's Commemorative ® ELITE Bib Short" in csv. So I have to remove "Â" from csv file through java file.
public boolean writeProductsToFile()
{
final List<ProductModel> products = getListrakDao().getProducts();
final String filePath = getFilePath() + getProductFileName();
final File file = new File(filePath);
FileWriter writer = null;
writer = new FileWriter(file);
for (final ProductModel productModel : products)
{
productData.append(StringEscapeUtils.unescapeHtml("\"" + productModel.getName() + "\""));
productData.append(getFieldSeparator());
writer.write(productData.toString());
}
}
This is my code...where "baseProduct.getName()" is fetching name of product. In database product name is "Men's Commemorative ® ELITE Bib Short". But in csv it is getting written as "Men's Commemorative ® ELITE Bib Short". So how can I remove characters like "Â". So tha#t name in csv should be like exactly in database.