Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
I use UTF-8 for my projects source. And use unicode, russians symbols.
I like QDevelop and that is why I start modify source of astyle plugin. And I
solve
the problem.
Solving:
In file astyleplugin.cpp in astyle-plugin-rev3.zip
using method of QString - toLocal8Bit()
This metod damage all not ASCII symbols (0 - 127).
I try to solve this by some modify:
#include <QTextStream>
...
QString AStylePlugin::text(QString text, QString selectedText)
{
...
// Open temp file for writing
QFile file( f );
if (!file.open(QIODevice::WriteOnly | QIODevice::Text ) )
return QString();
QTextStream out(&file);
//out.setCodec("UTF-8");
out << text;
//!!! Old version: file.write( text.toLocal8Bit() ); - damage all not ASCII
symbols (0 - 127)
file.close();
...
//Read results
file.open( QIODevice::ReadOnly | QIODevice::Text );
QTextStream in(&file);
//in.setCodec("UTF-8");
QString formattedContent;
formattedContent = in.readAll();
/*!!! Old version: Same problems
QString formattedContent = file.readAll();
*/
file.close();
...
}
By using QTextStream now I can work whith unicode and dont afread damage
comments!
Original comment by logforal...@googlemail.com
on 4 Mar 2009 at 3:10
Attachments:
Would you mind creating a patch against the newest version of astyle-plugin?
It's located:
http://qdevelop.googlecode.com/files/qdevelop-astyle-plugin-0.27.0-src.tar.bz2
It has additional "codec" parameter which was ignored in rev3.
Thank you
Original comment by Lord.Div...@gmail.com
on 4 Mar 2009 at 7:25
Fixed in r435
Original comment by Lord.Div...@gmail.com
on 5 Mar 2009 at 11:38
Original issue reported on code.google.com by
Lord.Div...@gmail.com
on 26 Feb 2009 at 12:20