Community
Participate
Working Groups
In the OCLinEcore editor, if a non ASCII character such as opening double quote, or closing double quote is saved in an annotation body, the file save appears to succeed but actually nothing happens.
Correction: There is a stderr message on the Console Log org.eclipse.core.runtime.CoreException: Some characters cannot be mapped using "Cp1252" character encoding. Either change the encoding or remove the characters which are not supported by the "Cp1252" character encoding. at org.eclipse.ui.editors.text.FileDocumentProvider.doSaveDocument(FileDocumentProvider.java:609) at org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.doSaveDocument(OCLinEcoreDocumentProvider.java:82) at org.eclipse.ui.texteditor.AbstractDocumentProvider$1$SaveOperation.execute(AbstractDocumentProvider.java:610) at org.eclipse.ui.texteditor.AbstractDocumentProvider$DocumentProviderOperation.run(AbstractDocumentProvider.java:74) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:75) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:65) at org.eclipse.ui.texteditor.AbstractDocumentProvider.executeOperation(AbstractDocumentProvider.java:551) at org.eclipse.ui.texteditor.AbstractDocumentProvider.saveDocument(AbstractDocumentProvider.java:629) at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:4868) at org.eclipse.ui.texteditor.AbstractTextEditor.doSave(AbstractTextEditor.java:4657) at org.eclipse.xtext.ui.editor.XtextEditor.doSave(XtextEditor.java:184)
Lack of diagnostic is a TODO e.printStackTrace() at OCLinEcoreDocumentProvider line 85. Problem is that saveAsEcore encodes the Unicode as UTF-8 for XMI which has a 0x80 byte that cannot be (re-)encoded as anything. This can be fixed by using a StringWriter rather than a ByteArrayOutputStream to serialize the Ecore XMI document. If the file folder is directly or indirectly set to UTF-8 encoding reading and writing of eg \u201c then works.
Created attachment 175732 [details] Eliminate spurious encoding Attached uses StringWriter to avoid encoding.
Committed to HEAD for 3.1.0M2 and to R3_0_maintenance for 3.0.1RC2.
Closing