OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000222OMNeT++IDE / NED editorpublic2010-12-10 07:442010-12-10 14:51
ReporterViRe 
Assigned Toandras 
PrioritynormalSeveritytextReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.1 
Target VersionFixed in Version4.2 
Summary0000222: Chinese comments become gibberish in NED files.
Description
If I use the "Clean up NED files..." function, the Chinese comments in my NED files will become gibberish.

//***********************************************************
//
// This is my file header
//

package src;

//
// 中文注释(Chinese Comments)
//
simple TestSimple
{
}
//***********************************************************

If I have a NED file like the upper one, and it is in the src folder. Now, I want to move the NED file into
another folder, so the package will be wrong. I can use the "Clean up NED files..." function to correct the
package. If I keep the NED Editor on, the Chinese comments still work right, but if I close the NED editor
when clean the NED files, the Chinese comments will become gibberish, like the following

//***********************************************************
//
// ???????(Chinese Comments)
//
simple TestSimple
{
}
//***********************************************************

In omnetpp4.1, the File header will be cleared too, but in 4.0, the File header will NOT be cleared.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000347)
andras (administrator)
2010-12-10 14:50

The error occurs because CleanupNedFilesAction writes out the changed files in the platform default encoding, instead of the file's own encoding. The Java code uses newContent.getBytes() instead of newContent.getBytes(file.getCharset()).

This causes a problem when NED files are in UTF-8, and the platform default encoding is some 8-bit format, e.g. ISO-8859-1 or Cp1252. Then newContent.getBytes() cannot represent the Chinese characters on 8 bits, and generates questions marks (?, x3F) instead. We'll this.

Workaround for 4.1: set the platform default encoding to UTF-8. This page can help: http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding [^]
(0000348)
andras (administrator)
2010-12-10 14:51

Fixed.

The bug also affected NED documentation generation; this was also fixed.

- Issue History
Date Modified Username Field Change
2010-12-10 07:44 ViRe New Issue
2010-12-10 14:50 andras Note Added: 0000347
2010-12-10 14:51 andras Note Added: 0000348
2010-12-10 14:51 andras Status new => resolved
2010-12-10 14:51 andras Fixed in Version => 4.2
2010-12-10 14:51 andras Resolution open => fixed
2010-12-10 14:51 andras Assigned To => andras


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker