Merge pull request #15882 from Zlash65/fixtds

[Minor] TDS not calculated properly fix
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 937911f..d030f5f 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -342,7 +342,7 @@
 	accounts = frappe.db.sql_list("""select name from `tabAccount`
 		where lft >= %s and rgt <= %s""", (root_lft, root_rgt))
 	additional_conditions += " and account in ('{}')"\
-		.format("', '".join([frappe.db.escape(d) for d in accounts]))
+		.format("', '".join([frappe.safe_encode(frappe.db.escape(d)) for d in accounts]))
 
 	gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year, debit_in_account_currency, credit_in_account_currency, account_currency from `tabGL Entry`
 		where company=%(company)s
@@ -379,8 +379,8 @@
 	if filters:
 		if filters.get("project"):
 			if not isinstance(filters.get("project"), list):
-				projects = str(filters.get("project")).strip()
-				filters.project = [d.strip() for d in projects.split(',') if d]
+				projects = frappe.safe_encode(filters.get("project"))
+				filters.project = [d.strip() for d in projects.strip().split(',') if d]
 			additional_conditions.append("project in %(project)s")
 
 		if filters.get("cost_center"):
@@ -400,7 +400,8 @@
 
 def get_cost_centers_with_children(cost_centers):
 	if not isinstance(cost_centers, list):
-		cost_centers = [d.strip() for d in str(cost_centers).strip().split(',') if d]
+		cost_centers = frappe.safe_encode(cost_centers)
+		cost_centers = [d.strip() for d in cost_centers.strip().split(',') if d]
 
 	all_cost_centers = []
 	for d in cost_centers: