Hi, I have a class named MyClass with "content" property with type TextArea.
I write some Groovy code to read a text file (*.txt) with encoding UTF-8, and print each line in the screen (code snippet 1) , no errors.
but when I replace code snippet (1) with (2), the following error occurs:
com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document ..Wrapped Exception: could not insert: xpn.xwiki.objects.Large String Property?
I try text files with encoding Unicode, replace UTF-8 with UNICODE, execute code snippet (1) and (2), both are ok.
Anyone can explain me why I'm getting error with UTF-8 and how to solve this problem ?
My code here:
byte[] bytes=...
String[] lines=new String(bytes,"UTF-8").split("\n");
list=mydoc.getObjects("XWiki.MyClass");
for (i in 0..<lines.length)
{
(1)
println lines[i];
(2)
newobj=mydoc.newObject("XWiki.MyClass");
newobj.set("content", lines[i]);
list.add(newobj);
}
mydoc.save();
--
Ngô Thị Hồng Nga