eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[editor] encoding problem for non ASCII characters #580

Closed eclipse-ocl-bot closed 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 321493 | | Status | CLOSED FIXED | | Importance | P3 normal | | Reported | Aug 02, 2010 07:08 EDT | | Modified | May 27, 2011 03:13 EDT | | Reporter | Ed Willink |

Description

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.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Aug 02, 2010 07:11

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)

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Aug 02, 2010 10:27

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.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Aug 02, 2010 16:31

Created attachment 175732 Eliminate spurious encoding

Attached uses StringWriter to avoid encoding.

:notepad_spiral: Bug321493.patch

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Aug 17, 2010 13:11

Committed to HEAD for 3.1.0M2 and to R3_0_maintenance for 3.0.1RC2.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 27, 2011 03:13

Closing