Page 1 of 1

[Solved] ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 9:01 am
by BubikolRamios
ü and such is a problem, does not get replaced in document. Any idea ?

Code: Select all

 matrix = Array(_
...
   Array ("überragend"," outstanding "),_

...

 oReplace = oDoc.createReplaceDescriptor()

  For i= Lbound(matrix,1) To Ubound(matrix,1)
  
    
     oReplace.SearchString = matrix(i)(0)           'Regular expression. Match any text
     oReplace.ReplaceString =  matrix(i)(1)           'Note the & places the found text back
     oReplace.SearchRegularExpression=False  'Use regular expressions
     oReplace.SearchCaseSensitive = False
     oReplace.searchAll=True                'Do the entire document
  
     oDoc.replaceAll(oReplace)
  Next i

Re: ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 10:00 am
by Villeroy
Works for me

Re: ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 2:24 pm
by BubikolRamios
Do explain following:
have two doc opened. In one there is iiberragend in bwetween of all other stuff, Copy all to second opened doc and ii becomes ü.

Doing replace on second doc.
Must be something with encoding .... ü that I see not realy beeing ü.

Re: ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 2:28 pm
by Villeroy
Encoding in ODF documents is always UTF-8.

Re: ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 2:32 pm
by BubikolRamios
So, the doc 1 has really been MS doc, after saving it into odt, copy paste does not produce ü anymore , ii stays ii.

Re: [Solved]ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 2:37 pm
by RoryOF
Copy and Paste your entire document into a blank .odt file; this should remove most, if not all, of MS .doc's voodoo.

Re: [Solved]ReplaceDescriptor/UTF-8

Posted: Sun Jun 14, 2020 2:44 pm
by Villeroy
MS docs before Office 97 may have different encodings. When you have to open such things:
menu:File>Open...
Choose file type "MS Word 6.0 / 95 (*.doc)"