Codebase list ctdconverter / 2e03f09
[fix] suggestion to fix #22 allows to handle unicode in label and description text walzer 6 years ago
1 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
11331133 label = ""
11341134 help_text = ""
11351135 # This tag is found in some descriptions
1136 desc = str(desc).replace("#br#", " <br>")
1136 # desc = str(desc).replace("#br#", " <br>")
1137 if not isinstance(desc, basestring):
1138 desc = str(desc)
1139 desc = desc.encode("utf8").replace("#br#", " <br>")
11371140 # Get rid of dots in the end
11381141 if desc.endswith("."):
1139 desc = desc.rstrip(".")
1142 desc = desc.rstrip(".")
11401143 # Check if first word is a normal word and make it uppercase
11411144 if str(desc).find(" ") > -1:
11421145 first_word, rest = str(desc).split(" ", 1)
11431146 if str(first_word).islower():
1144 # check if label has a quotient of the form a/b
1147 # check if label has a quotient of the form a/b
11451148 if first_word.find("/") != 1 :
11461149 first_word.capitalize()
11471150 desc = first_word + " " + rest
1148 label = desc
1151 label = desc.decode("utf8")
11491152
11501153 # Try to split the label if it is too long
11511154 if len(desc) > 50: