Ask a Question

Groovy script does not write UTF-8

Buschfunk
Frequent Contributor

Groovy script does not write UTF-8

Hello,

I need to write UTF-8 encoded files from within a Groovy script. This looks as follows:

def f = new File("C:/temp/test.txt")
f.write("test", "UTF-8")

However the resulting file is in standard ANSI format. Opening it in a hex editor does not show the "magic bytes" 0xEFBBEF.

Regards,
Robert
1 REPLY 1
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi Robert,

for strictly groovy-related questions please check out the groovy website (http://groovy.codehaus.org/) and their related forum.

regards!

/Ole
SmartBear Software

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: