Strange characters in shared code

Just starting out? Need help? Post your questions and find answers here.
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Strange characters in shared code

Post 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
Last edited by BarryG on Thu Mar 14, 2024 7:50 am, edited 1 time in total.
AZJIO
Addict
Addict
Posts: 2226
Joined: Sun May 14, 2017 1:48 am

Re: Strange characters in shared code

Post by AZJIO »

Replace E2 80 82 with a space (32)
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Strange characters in shared code

Post by BarryG »

Yep, but more worried that this is a copy issue with code from the IDE?
AZJIO
Addict
Addict
Posts: 2226
Joined: Sun May 14, 2017 1:48 am

Re: Strange characters in shared code

Post 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 "||"
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Strange characters in shared code

Post 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?
AZJIO
Addict
Addict
Posts: 2226
Joined: Sun May 14, 2017 1:48 am

Re: Strange characters in shared code

Post by AZJIO »

The mail editor could have broken the code.
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Strange characters in shared code

Post by BarryG »

Fair call.
AZJIO
Addict
Addict
Posts: 2226
Joined: Sun May 14, 2017 1:48 am

Re: [Done] Strange characters in shared code

Post by AZJIO »

What encoding was the file sent in? If in ANSI, then characters 128-255 will be broken.
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: [Done] Strange characters in shared code

Post 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
User avatar
Blue
Addict
Addict
Posts: 972
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: [Done] Strange characters in shared code

Post 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...
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Little John
Addict
Addict
Posts: 4805
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Strange characters in shared code

Post 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.
User avatar
Blue
Addict
Addict
Posts: 972
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Strange characters in shared code

Post 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.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Post Reply