Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1786 connectés 

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Problème pour exporter mon site

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème pour exporter mon site

n°1495775
jcqguill
Posté le 24-12-2006 à 10:42:30  profilanswer
 

Bonjour,
Voilà, donc j'ai récemment mit un site en ligne en utilisant le script php-fusion, qui permet de faire des articles, des news..etc
 
J'ai donc déjà ajouté pas mal de chose, et pour des raisons perso j'ai besoin de déplacer se site sur un autre serveur.
 
Mais voilà le problème est que pour faire mes articles, news etc... Je n'est pas utilisé les caractères spéciaux html comme par exemple : le é => é
 
Du coup lorsque j'ai exporté mon site tous les é deviennent des ? et les autres caractères spéciaux aussi bien évidement, comme le ê, à, è etc...
 
En fait, j'aurais voulu savoir si il existe une méthode qui me permet d'éviter de refaire tous mes articles, news, etc..
 
ps: Bonne fête à tous

mood
Publicité
Posté le 24-12-2006 à 10:42:30  profilanswer
 

n°1495822
olivthill
Posté le 24-12-2006 à 16:04:54  profilanswer
 

Voici un petit programme qui fait la transformation.

' Remplace les accents Windows par des accents HTML
' ==================================================
' Selecting a file in a common file dialog window  
 
Class SelectFile
Private fso, sPath1
 
   Private Sub Class_Initialize()
      Set fso = CreateObject("Scripting.FileSystemObject" )
   End Sub
 
   Private Sub Class_Terminate()
      Set fso = Nothing
   End sub
 
   Public Function Browse()
      On Error Resume Next
      sPath1 = GetPath
      Browse = sPath1
   End function
 
   Private Function GetPath()
      Dim Ftemp, ts, IE, sPath
 
      Ftemp = fso.GetSpecialFolder(2)
      Ftemp = Ftemp & "\FileBrowser.html"
      Set ts = fso.CreateTextFile(Ftemp, true)
 
      ts.WriteLine "<html>"
      ts.WriteLine "<body bgcolor=" & chr(34) & "#F3F3F8" & chr(34) & " text=" & chr(34) & "black" & chr(34) & ">"
      ts.WriteLine "<script language=" & chr(34) & "VBScript" & chr(34) & ">"
 
      ts.WriteLine "sub but_onclick()"
      ts.WriteLine "status = document.forms(0).elements(0).value"
      ts.WriteLine "end sub"
 
      ts.WriteLine "sub butc_onclick()"
      ts.WriteLine "status = " & chr(34) & "cancel" & chr(34)
      ts.WriteLine "end sub"
      ts.WriteLine "</script>"
 
      ts.WriteLine "<div align=" & chr(34) & "center" & chr(34) & ">"
      ts.WriteLine "<br>"
      ts.WriteLine "<form>"
 
      ts.WriteLine "<input type=" & chr(34) & "file" & chr(34) & "></input>"
 
      ts.WriteLine "<input type=" & chr(34) & "button" & chr(34) & " id=" & chr(34) & "but" & chr(34) & " value=" & chr(34) & "OK" & chr(34) & "></input>"
      ts.WriteLine "<br>"
 
      ts.WriteLine "<input type=" & chr(34) & "button" & chr(34) & " id=" & chr(34) & "butc" & chr(34) & " value=" & chr(34) & "CANCEL" & chr(34) & "></input>"
      ts.WriteLine "<br> Browse for file, then click OK."
      ts.WriteLine "</form>"
      ts.WriteLine "</div>"
      ts.WriteLine "</body></html>"
      ts.Close
      Set ts = Nothing
      On Error Resume Next
 
      Set IE = Wscript.CreateObject("InternetExplorer.Application" )
      IE.Navigate "file:///" & Ftemp
      IE.AddressBar = false
      IE.menubar = false
      IE.ToolBar = false
      IE.width = 400
      IE.height = 250
      IE.resizable = true
      IE.visible = true
 
      Do While IE.visible = True
         spath = IE.StatusText  
         If fso.FileExists(spath) = true or spath = "cancel" or IE.visible = false Then
            Exit Do  
         End If
         wscript.sleep 500
      Loop
      IE.visible = False
      IE.Quit
      Set IE = Nothing
      If fso.FileExists(spath) = True Then
         GetPath = spath
      Else
         GetPath = ""
      End If  
   End Function
 
End Class
 
' ==================================================
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f_in, f_out
Dim i
 
' 1. Select the file that should be changed
Dim select_file_win, file_in, file_out
 
Set select_file_win = New SelectFile
file_in = select_file_win.Browse
file_out = "aaaa.tmp"
If (file_in <> "" ) Then
   file_out = file_in & "_tmp"
End If
Set select_file_win = nothing
 
' 2. Replace diacritics
Set fso = CreateObject("Scripting.FileSystemObject" )
 
Set f_in = fso.OpenTextFile(file_in, ForReading)
Set f_out = fso.OpenTextFile(file_out, ForWriting, true)
 
Do Until f_in.AtEndOfStream
   text_line = f_in.ReadLine
   new_text_line = ""
   For i = 1 To Len(text_line)
      c = Mid(text_line, i, 1)
      If (c = "ü" ) Then c = "&uuml;"
      If (c = "é" ) Then c = "&ecute;"
      If (c = "â" ) Then c = "&acirc;"
      If (c = "ä" ) Then c = "&auml;"
      If (c = "à" ) Then c = "&agrave;"
      If (c = "ç" ) Then c = "&ccedil;"
      If (c = "ê" ) Then c = "&ecirc;"
      If (c = "ë" ) Then c = "&euml;"
      If (c = "è" ) Then c = "&egrave;"
      If (c = "ï" ) Then c = "&iuml;"
      If (c = "î" ) Then c = "&icirc;"
      If (c = "ô" ) Then c = "&ocirc;"
      If (c = "ö" ) Then c = "&ouml;"
      If (c = "û" ) Then c = "&ucirc;"
      If (c = "ù" ) Then c = "&ugrave;"
      new_text_line = new_text_line & c
   Next
   f_out.WriteLine new_text_line
Loop
 
f_in.Close
f_out.Close
 
fso.DeleteFile file_in, true
fso.MoveFile file_out, file_in

Mettre ces lignes dans un fichier nommé cvtaccent.vbs
Cliquer sur le programme pour le lancer.
Appuyer sur le bouton "parcourir" pour choisir un fichier à convertir.
Appuyer sur le bouton "OK".
Recommencer pour chaque fichier.
 
Si on a beaucoup de fichiers, on peut adapter ce programme de manière à remplacer la sélection manuelle des fichiers par une sélection à partir d'une liste de fichiers ou à partir des fichiers trouvés dans un répertoire particulier.


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Problème pour exporter mon site

 

Sujets relatifs
probleme creation de tablesphp->pdf->probleme affichage image
probléme idiot mais bonproblème d'affichage en c++
Center mon site sous IEProblème connexion apache
Probleme de menu deroulant sous IE7[RESOLU] probleme d'égalités CA URGE MERCI LES GENS
probleme ouverture popup 
Plus de sujets relatifs à : Problème pour exporter mon site


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR