我正在尝试使用databrics
库处理XML文件。在这种情况下,有一些特殊字符,如‘
。写入csv文件后,文本看起来像‘
。为此我尝试了以下方法:
df.select($"column",translate($"column","T","A").as("new_column")).show()
df.withColumn("column", concat_ws(",",$"column".cast(sql.types.StringType)))
.select($"column",regexp_replace($"column","‘","AP").as("column"))
在上述两种情况下,我没有得到正确的输出。它再次返回‘
。
有没有办法让文字原样?
input : Nectarine tree named ‘Polar Zee’
current Output: Nectarine tree named ‘Polar Zee’
expected Output : Nectarine tree named ‘Polar Zee’