Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 25/09/2007, à 18:15

Zoloom

Problème d'encodage très dérangant

Bonjour,

Je programme en C++, et j'ai la surprise de voir qu'un de mes vieux problèmes d'encodages refait surface.

En effet je compile un code source juste et voilà le résultat :

zoloom@zoloom-desktop:~/Programmation/Cpp/µFragGUIv3$ g++ gui.cpp -o uFrag `wx-config --libs --cppflags`
In file included from gui.cpp:32:
gui.hpp:7: erreur: stray «\302" in program
gui.hpp:7: erreur: stray «\265" in program
gui.hpp:13: erreur: stray «\302" in program
gui.hpp:13: erreur: stray «\265" in program
gui.hpp:13: erreur: stray «\302" in program
gui.hpp:13: erreur: stray «\265" in program
gui.hpp:13: erreur: stray «\302" in program
gui.hpp:13: erreur: stray «\265" in program
gui.hpp:13: erreur: stray «\302" in program
gui.hpp:13: erreur: stray «\265" in program
gui.cpp:36: erreur: stray «\302" in program
gui.cpp:36: erreur: stray «\265" in program

En gros l'encodage n'est pas bon. J'utilise Anjuta, j'ai beau avoir testé UTF-8 et ISO-8859-15 eh ben j'ai toujours la même erreur.

Y aurait t-il un moyen d'éviter ce genre d'erreur d'encodage?

Merci d'avance


[img]http://webstatus.kd2.org/cache/456597a86a9df9f1e7a7d03fc2f4e601.png[/img]

Hors ligne

#2 Le 25/09/2007, à 18:42

Skippy le Grand Gourou

Re : Problème d'encodage très dérangant

Que donne :
file gui.cpp

Je connais pas Anjuta, mais a priori il doit y avoir un (autre) endroit où régler l'encodage...

Hors ligne

#3 Le 26/09/2007, à 20:46

Zoloom

Re : Problème d'encodage très dérangant

main.hpp

#ifndef WX_PRECOMP

    #include <wx/wx.h>

#endif



#pragma once



class µFragGUI : public wxApp

{

  public:

    virtual bool OnInit();

};

 

IMPLEMENT_APP(µFragGUI); 



class Fenp : public wxFrame 

{ 

    private:       

		

		//#################### Section Fragmentation ################

		

		//Fichier original

		 

		wxStaticText *txtFichierOriginal;

		wxTextCtrl *txtcFichierOriginal;

		wxButton *buttonDirFichierOrignal;

		wxString *m_fichierOrignal;

		wxStaticBoxSizer *boxsFichierOriginal;

		

		//Dossier destination

		

		wxStaticText *txtDossierDestination;

		wxTextCtrl *txtcDossierDestination;

		wxButton *buttonDossierDestination;

		wxString *m_dossierDestination;

		std::string m_extensionFrgGui;

		wxStaticBoxSizer *boxsDossierDestination;

	

		//Type de fragmentation

	

		wxRadioBox *radioTypeFragmentation;

		std::string m_typeFragmentationGUI;

		wxStaticBoxSizer *boxsTypeFragmentation;

		

		//Si taille

	

		wxStaticText *txtTailleFragment;

		wxSpinCtrl *spincTailleFragment;

		std::string m_tailleFragmentGUI;

		wxStaticBoxSizer *boxsTailleFragment;

	

		//Si nombre

	

		wxStaticText *txtNombreFragment;

		wxSpinCtrl *spincNombreFragment;

		std::string m_nombreFragmentGUI;

		wxStaticBoxSizer *boxsNombreFragment;

	

		//Box principale 

	

		wxBoxSizer *boxFragmentation;

	

		//#################### Section Defragmentation ################

	

		//Emplacement premier fragmentation

		

		wxStaticText *txtPremierFragment;

		wxTextCtrl *txtcPremierFragment;

		wxButton *buttonPremierFragment;

		std::string m_premierFragmentGUI;

		wxStaticBoxSizer *boxsPremierFragment;

	

		//Chemin de destination

	

		wxStaticText *txtFichierDefragmente;

		wxTextCtrl *txtcFichierDefragmente;

		wxButton *buttonFichierDefragmente;

		std::string m_fichierDefragmenteGUI;

		wxStaticBoxSizer *boxsFichierDefragmente;

	 

		//Box principale 

	

		wxBoxSizer *boxDefragmentation;

		

		//#################### Section A propos ################

		

		//#################### Onglets ################



		wxNotebook *notFenp;

		wxBoxSizer *boxNoteBook;

	

		wxPanel *panelFragmentation;

		wxPanel *panelDefragmentation;

		wxPanel *panelApropos;

	  

        DECLARE_EVENT_TABLE()



    public:



        Fenp(const wxString& title, const wxPoint& pos, const wxSize& size,

                        long style = wxSYSTEM_MENU | wxCAPTION | wxMINIMIZE_BOX | wxCLOSE_BOX | wxCLIP_CHILDREN);



};

main.cpp

#include <iostream>

#include <string>

#include <fstream>

#include <dirent.h>



#include <wx/textdlg.h>

#include <wx/textctrl.h> 

#include <wx/stattext.h>

#include <wx/sizer.h>

#include <wx/file.h>

#include <wx/textctrl.h>

#include <wx/msgdlg.h>

#include <wx/process.h> 

#include <wx/msgdlg.h>

#include <wx/event.h> 

#include <wx/arrstr.h>

#include <wx/wxprec.h>

#include <wx/dirdlg.h>

#include <wx/statbmp.h>

#include <wx/listbox.h>

#include <wx/dir.h>

#include <wx/splash.h>

#include <wx/spinctrl.h>

#include <wx/panel.h>

#include <wx/notebook.h>

#include <wx/intl.h>

#include <wx/stream.h>

#include <wx/radiobox.h>

#include <wx/busyinfo.h>

#include <wx/utils.h> 



#include "gui.hpp"

 

using namespace std;



bool µFragGUI::OnInit() // fonction principale

{

	/*// Gestion de la langue

	// Ajout des prefixes possibles de chemins d'acces aux catalogues

	wxLocale::AddCatalogLookupPathPrefix(_T("."));

	wxLocale::AddCatalogLookupPathPrefix(_T(".."));

	wxLocale::AddCatalogLookupPathPrefix(_T("locale"));

	// Mise en place de la langue par defaut du systeme

	m_locale.Init(wxLANGUAGE_DEFAULT);

	{

   		wxLogNull noLog; // Supprime les erreurs si les catalogues n'existent pas

   		// Catalogue de l'application

   		m_locale.AddCatalog(_T("pol"));

   		// Catalogue de wxWidgets

   		m_locale.AddCatalog(_T("wxstd"));

	}*/



    Fenp *fenp = new Fenp(_T("µFrag - Version 1.0"), wxDefaultPosition, wxDefaultSize); //declaration de la fenetre principale issu du type fenp

	fenp->Show(true);

	SetTopWindow(fenp);

	return true;

}





Fenp::Fenp(const wxString& title, const wxPoint& pos, const wxSize& size,

                        long style) : wxFrame(NULL, -1, title, pos, size, style)

{

   	SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); //fond 3d

	//wxIcon icoFenp(_T("")); //declaration de l'icone

	//SetIcon(icoFenp); //on le lie a la fenetre

							

	//#################### Onglets ################

							

	notFenp = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, 0);

	boxNoteBook = new wxBoxSizer(wxVERTICAL);



	panelFragmentation = new wxPanel(notFenp, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);

	panelDefragmentation = new wxPanel(notFenp, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);

    panelApropos = new wxPanel(notFenp, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);				



	//#################### Section Fragmentation ################

	

	//Fichier original

	

	txtFichierOriginal = new wxStaticText(panelFragmentation, -1, _(""), wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);

	txtcFichierOriginal = new wxTextCtrl(panelFragmentation, -1, "",wxDefaultPosition, wxSize(180,30),wxTE_CENTRE);

	buttonDirFichierOrignal = new wxButton(panelFragmentation,-1, _("Parcourir"),wxDefaultPosition,wxSize(120,30));

	

	boxsFichierOriginal = new wxStaticBoxSizer(wxHORIZONTAL,panelFragmentation,"Emplacement du fichier a fragmenter");

		boxsFichierOriginal->Add(txtFichierOriginal,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsFichierOriginal->Add(txtcFichierOriginal,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsFichierOriginal->Add(buttonDirFichierOrignal,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

							

	//Dossier destination

	

	txtDossierDestination = new wxStaticText(panelFragmentation, -1, _(""), wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);

	txtcDossierDestination = new wxTextCtrl(panelFragmentation, -1, "",wxDefaultPosition, wxSize(180,30),wxTE_CENTRE);

	buttonDossierDestination = new wxButton(panelFragmentation,-1, _("Parcourir"),wxDefaultPosition,wxSize(120,30));

	m_extensionFrgGui = "";

	

	boxsDossierDestination = new wxStaticBoxSizer(wxHORIZONTAL,panelFragmentation,"Dossier de destionation des fragments");

		boxsDossierDestination->Add(txtDossierDestination,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsDossierDestination->Add(txtcDossierDestination,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsDossierDestination->Add(buttonDossierDestination,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

	 

	//Type de fragmentation

	

	wxString arrayTypeFragmentation[2]={"Fragmentation par taille", "Fragmentation par nombre"};

							

	radioTypeFragmentation = new wxRadioBox(panelFragmentation, -1, "", wxDefaultPosition, wxDefaultSize, 2, arrayTypeFragmentation, 2, wxRA_SPECIFY_COLS);

	m_typeFragmentationGUI = "";

	

	boxsTypeFragmentation = new wxStaticBoxSizer(wxHORIZONTAL,panelFragmentation,"Choix du type de fragmentation");

		

	//Si taille

	

	txtTailleFragment = new wxStaticText(panelFragmentation, -1, _(""), wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);

	spincTailleFragment = new wxSpinCtrl(panelFragmentation, -1, "",wxDefaultPosition, wxSize(180, 30),wxSP_ARROW_KEYS | wxTE_CENTRE,2,10);

	m_tailleFragmentGUI = "";

	

	boxsTailleFragment = new wxStaticBoxSizer(wxHORIZONTAL,panelFragmentation,"Taille d'un fragment");

		boxsTailleFragment->Add(txtTailleFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsTailleFragment->Add(spincTailleFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

	

	//Si nombre



	txtNombreFragment = new wxStaticText(panelFragmentation, -1, _(""), wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);

	spincNombreFragment = new wxSpinCtrl(panelFragmentation, -1, "",wxDefaultPosition, wxSize(180, 30),wxSP_ARROW_KEYS | wxTE_CENTRE,2,10);

	m_nombreFragmentGUI = "";

	

	boxsNombreFragment = new wxStaticBoxSizer(wxHORIZONTAL,panelFragmentation,"Nombre de fragments");

		boxsNombreFragment->Add(txtNombreFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsNombreFragment->Add(spincNombreFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

									

	//Box principale



	boxFragmentation = new wxBoxSizer(wxVERTICAL);

		boxFragmentation->Add(boxsFichierOriginal,0,wxEXPAND,5);

		boxFragmentation->Add(boxsDossierDestination,0,wxEXPAND,5);

		boxFragmentation->Add(boxsTypeFragmentation,0,wxEXPAND,5);

		boxFragmentation->Add(boxsTailleFragment,0,wxEXPAND,5);

		boxFragmentation->Add(boxsNombreFragment,0,wxEXPAND,5);





	//#################### Section Defragmentation ################



	//Emplacement premier fragmentation

	

	txtPremierFragment = new wxStaticText(panelDefragmentation, -1, _(""), wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);

	txtcPremierFragment = new wxTextCtrl(panelDefragmentation, -1, "",wxDefaultPosition, wxSize(180,30),wxTE_CENTRE);

	buttonPremierFragment = new wxButton(panelDefragmentation,-1, _("Parcourir"),wxDefaultPosition,wxSize(120,30));

	m_premierFragmentGUI = "";

	

	boxsPremierFragment = new wxStaticBoxSizer(wxHORIZONTAL,panelDefragmentation,"Selectionner un fragment");

		boxsPremierFragment->Add(txtPremierFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsPremierFragment->Add(txtcPremierFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsPremierFragment->Add(buttonPremierFragment,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		

	//Chemin de destination



	txtFichierDefragmente = new wxStaticText(panelDefragmentation, -1, _(""), wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);

	txtcFichierDefragmente = new wxTextCtrl(panelDefragmentation, -1, "",wxDefaultPosition, wxSize(180,30),wxTE_CENTRE);

	buttonFichierDefragmente = new wxButton(panelDefragmentation,-1, _("Parcourir"),wxDefaultPosition,wxSize(120,30));

	m_fichierDefragmenteGUI = "";

	

	boxsFichierDefragmente = new wxStaticBoxSizer(wxHORIZONTAL,panelDefragmentation,"Chemin du fichier defragmente");

		boxsFichierDefragmente->Add(txtFichierDefragmente,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5); 

		boxsFichierDefragmente->Add(txtcFichierDefragmente,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

		boxsFichierDefragmente->Add(buttonFichierDefragmente,1,wxALL|wxALIGN_CENTER_HORIZONTAL,5);

							

	//Box principale



	boxDefragmentation = new wxBoxSizer(wxVERTICAL);

		boxDefragmentation->Add(boxsPremierFragment,0,wxEXPAND,5);

		boxDefragmentation->Add(boxsFichierDefragmente,0,wxEXPAND,5);

	

	//#################### Section A propos ################

							

    //#################### Mise en place des onglets #############

		

	boxNoteBook->Add(notFenp,0,wxALL|wxEXPAND,2);						

							

	notFenp->AddPage(panelFragmentation, _("Fragmentation"), true, -1);

	notFenp->AddPage(panelDefragmentation, _("Defragmentation"), false, -1);

	//notFenp->AddPage(panelApropos, _("a propos"), false, -1);	

	

	panelFragmentation->SetSizer(boxFragmentation);

	panelDefragmentation->SetSizer(boxDefragmentation);

	//panelApropos->SetSizer(boxA);

							

	SetSizer(boxNoteBook); 

	boxNoteBook->SetSizeHints(this);

							

} 





BEGIN_EVENT_TABLE( Fenp, wxFrame)



END_EVENT_TABLE()

Bonjour à vous, et merci de votre aide, mais sa ne vient pas du code on dirait.


[img]http://webstatus.kd2.org/cache/456597a86a9df9f1e7a7d03fc2f4e601.png[/img]

Hors ligne

#4 Le 26/09/2007, à 21:10

Skippy le Grand Gourou

Re : Problème d'encodage très dérangant

Je te demandais juste de faire dans un terminal :

file gui.hpp

ce qui donne l'encodage du fichier. wink

De plus, tu donnes main.cpp et main.hpp, alors que c'est gui.cpp qui pose problème, non ?

Mais de toute façon, commence par virer tous ces "µ" partout. J'ai essayé d'en mettre un dans un fichier test pour voir, et ça me met aussi plein d'erreurs stray machin à la compilation.

Dernière modification par Skippy le Grand Gourou (Le 26/09/2007, à 21:11)

Hors ligne

#5 Le 26/09/2007, à 21:21

robrob

Re : Problème d'encodage très dérangant

C'est le "µ" dans le nom de la fonction qui doit poser problème. Utilise un simple "u" à la place.

edit: oouuuups grillé, j'avais pas lu la réponse précédente jusqu'au bout lol

Dernière modification par robrob (Le 26/09/2007, à 21:22)

Hors ligne

#6 Le 28/09/2007, à 16:40

Zoloom

Re : Problème d'encodage très dérangant

lol Sa venait des µ, merci bien!


[img]http://webstatus.kd2.org/cache/456597a86a9df9f1e7a7d03fc2f4e601.png[/img]

Hors ligne