[Gambas-user] bizarre invisible chars

Bruce Steers bsteers4 at gmail.com
Sat Jan 7 17:28:28 CET 2023


Cheers Charlie , that's much simpler.

It has the same problem i had though where it removes all indentation
(leading spaces)
I had to replace bad chars for spaces then split the text and RTrim it all.
I think that way adds a space but better than loosing all indentation i
guess.

Public Sub mnuValidateText_Click()

 Dim sText As String = tEditor.Text
  Dim sNewText As String
  Dim iLoop As Integer

  For iLoop = 0 To Len(sText) - 1
    If Asc(sText[iLoop]) > 0 And Asc(sText[iLoop]) < 128 Then sNewText &=
sText[iLoop] Else sNewText &= " "
  Next

  Dim aLines As String[] = Split(sNewText, "\n")
  For c As Integer = 0 To alines.Max
    aLines[c] = RTrim(aLines[c])
  Next

  sNewText = aLines.Join("\n")

tEditor.Text = sNewText

End

Does anyone know if leading spaces have an ascii value outside 0-128 ?

Cheers

BruceS


On Sat, 7 Jan 2023 at 16:08, Charlie Ogier <charlie at cogier.com> wrote:

>
>
> On 07/01/2023 06:00, Bruce Steers wrote:
>
>
>
> On Fri, 6 Jan 2023 at 23:38, BB <adamnt42 at gmail.com> wrote:
>
>> On 7/1/23 9:49 am, Bruce Steers wrote:
>>     etc
>>
>> Well matey, I tried both your attached script and the GambasOne methods
>> you describe and got no errors at all in 6 or so different editors
>> including the IDE. The only way I could find a way to force your mysterious
>> junk to appear was to paste the clipboard directly into a terminal. There I
>> see some text is repeated... like the old impact printer way of producing
>> bold or perhaps it was backspaced? (memory failure here)
>>
>> Best of luck.
>>
>
> Cheers for having a look fella , i got there eventually (it's 6am , so was
> a long night :-\ )
> I discovered the bloomin utf-8 chars all over it (and the problems they
> cause) after Christof's nudge in the right direction :)
>
> Time for sleep
>
> Respects
> BruceS
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
>
> Hi Bruce,
>
> This code works for me.
>
> Charlie
> '*****************************************
> Public Sub Form_Open()
>
>   Dim sFile As String = File.Load(Application.Path &/ "NextBoot2")
>   Dim sNewFile As String
>   Dim iLoop As Integer
>
>   For iLoop = 0 To Len(sFile) - 1
>     If Asc(sFile[iLoop]) > 0 And Asc(sFile[iLoop]) < 128 Then sNewFile &=
> sFile[iLoop]
>   Next
>
>   Clipboard.Copy(sNewFile)                                          'Copy
> to clipboard or Save to file
>   'File.Save(Application.Path &/ "NextBoot2FIXED", sNewFile)        'Copy
> to clipboard or Save to file
>
> End
> '*****************************************
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230107/e6a901fc/attachment.htm>


More information about the User mailing list