Sparx Systems Forum
Enterprise Architect => Bugs and Issues => Topic started by: nilspc on December 02, 2022, 11:13:50 pm
-
Hi,
I'm trying to update the note field for components with text containing Swedish characters like ö ä å with a javascript.
I have them in an UTF-8 text file and have set the option "code page for source editing" to UTF-8
But when I import they get corrupted when importing into the notes field, works fine for import into tagged values.
Any ideas? Is there something special with the notes field?
Running v16.0.1604
Regards
Nils
-
Someone reported a similar problem a few days ago.
Have you tried with the latest version (16.1.1622)?
Can you also post the code that you are using to update the notes, and how they get corrupted?
EA saves the notes in a xml like format in the database, so the "special" characters will get xml encoded.
They should look allright when viewing using the GUI
You might need to use the function Repository.GetFieldFromFormat (string Format, string Text) before saving to the notes.
Geert
-
Hi,
The essential bit of the code
app = Repository.GetElementByGuid(sourceGUID);
app.Notes = applicationToCheck[15]; //array imported from a text file
app.Update();
app.Refresh();
The corruption is that the characters shows like a box with a question mark inside in Sparx and similar in Prolaborate
/N
-
Hi,
And tested this but didn't work
app = Repository.GetElementByGuid(sourceGUID);
Xnote = Repository.GetFormatFromField("TXT", applicationToCheck[15]);
app.Notes = Xnote;
app.Update();
app.Refresh()
/N
-
Hi,
And tested this but didn't work
app = Repository.GetElementByGuid(sourceGUID);
Xnote = Repository.GetFormatFromField("TXT", applicationToCheck[15]);
app.Notes = Xnote;
app.Update();
app.Refresh()
/N
Have you checked what get put into Xnote?
Does it work with the current version (or v15)?
Geert
PS. You can loose the call to Refresh()
-
Hi,
Thanks for quick respons :D
In debug Xnotes are just text and looks correct.
Seems like I need to test another version of Sparx and see if that is the problem.
During my tests I have seen some weird behavior that the text I import into tagged values also sometimes gets corrupted but with no apparent pattern when it happens.
Thanks for the call to Refresh() tip :-)
/Nils
-
Hi,
Just an update for those who are interested
It is the same problem in 15.2 and 16.1
/Nils
-
Xnote = Repository.GetFormatFromField("TXT", applicationToCheck[15]);
This call would be to take EA's internal notes format and write it as plain text. ie. The opposite of what you wanted.
Xnote = Repository.GetFieldFromFormat("TXT", applicationToCheck[i][15]);ie. You have plain text and you want to convert it to EA's internal format.
-
Hi,
Thank you Eve
That solved the problem
/Nils