Page 1 of 1

Strange characters in shared code

Posted: Thu Mar 14, 2024 5:30 am
by BarryG
Someone just sent me an email with some PureBasic code, but when I paste it into the IDE to compile, I get a syntax error. I pasted to Notepad and saw no issues, so I pasted into a hex editor and saw these strange characters. Any ideas?

Image

Re: Strange characters in shared code

Posted: Thu Mar 14, 2024 5:40 am
by AZJIO
Replace E2 80 82 with a space (32)

Re: Strange characters in shared code

Posted: Thu Mar 14, 2024 5:59 am
by BarryG
Yep, but more worried that this is a copy issue with code from the IDE?

Re: Strange characters in shared code

Posted: Thu Mar 14, 2024 7:24 am
by AZJIO
What does the IDE have to do with it? You were given this code initially. I can assume that there are a lot of spaces in Unicode (9, 32, 160), as well as the dash symbol of different widths.

Code: Select all

Debug "|" + Chr(9) + "|"
Debug "|" + Chr(32) + "|"
Debug "|" + Chr(160) + "|"
Debug "|" + Chr($2002) + "|"
Debug "|" + Chr($2003) + "|"
Debug "|" + Chr($2004) + "|"
Debug "|" + Chr($2005) + "|"
Debug "|" + Chr($2006) + "|"
Debug "|" + Chr($2009) + "|"
Debug "|" + Chr($200A) + "|"
Debug "||"

Re: Strange characters in shared code

Posted: Thu Mar 14, 2024 7:36 am
by BarryG
AZJIO wrote: Thu Mar 14, 2024 7:24 amWhat does the IDE have to do with it?
It was copied from the IDE of one user and emailed to me. I pasted it into the IDE and it doesn't compile due to those invisible characters at the start of every line. Kind of makes sharing code by email 100% useless, don't you think?

Re: Strange characters in shared code

Posted: Thu Mar 14, 2024 7:47 am
by AZJIO
The mail editor could have broken the code.

Re: Strange characters in shared code

Posted: Thu Mar 14, 2024 7:50 am
by BarryG
Fair call.

Re: [Done] Strange characters in shared code

Posted: Thu Mar 14, 2024 7:54 am
by AZJIO
What encoding was the file sent in? If in ANSI, then characters 128-255 will be broken.

Re: [Done] Strange characters in shared code

Posted: Thu Mar 14, 2024 8:09 am
by BarryG
It was in the body of an email (Gmail). Not an attachment. I just copied the email text, pasted it into the IDE, and tried to compile it. Syntax error. So yeah, probably Gmail broke it. Here's how it looks in Gmail, and how I copied it. You'd assume you could just paste that into the IDE and run it, right?

Image

Re: [Done] Strange characters in shared code

Posted: Sun Mar 31, 2024 5:28 pm
by Blue
BarryG wrote: Thu Mar 14, 2024 8:09 am [...] You'd assume you could just paste that into the IDE and run it, right?

[...]
No.
Email clients don't follow any standard.
They each have their idiosyncratic rules and complications.
They just watched the parade as HTML evolved to version 5...

Re: Strange characters in shared code

Posted: Sun Mar 31, 2024 5:57 pm
by Little John
BarryG wrote: Thu Mar 14, 2024 7:36 am Kind of makes sharing code by email 100% useless, don't you think?
Sharing code in the body of an e-mail actually is not a good idea.
Better attach your .pb file(s) to the mail.

Re: Strange characters in shared code

Posted: Sun Mar 31, 2024 10:36 pm
by Blue
Little John wrote: Sun Mar 31, 2024 5:57 pm […]
Sharing code in the body of an e-mail actually is not a good idea.
Better attach your .pb file(s) to the mail.
👍
Exactly… as BarryG clearly experienced.