PC Review


Reply
Thread Tools Rate Thread

Cannot Dechiper Encoded String

 
 
Dudely
Guest
Posts: n/a
 
      11th Nov 2008
I pull a text string off a web page, that contains some random text.
From time to time, the string will contain a mixture of ASCII and ISO
encoded characters. Sample below.

I'm unable to get any function to recognize the string.

I'm using VBA 6.0 with Excel 2000

Example code:

Subject= "Auction"

Subject = Replace(Subject, "B", "A")

I've also tried every other character that should be in that string.

The replacement never takes place, the string is unmodified. I've
also tried searching for just "&#" but it never finds that either.
I've tried using InStr as well but that fails to find a match too.
The goal is of course to dechiper the (random) string into it's ASCII
equivalent (so that it can be read by a human).

Any help?

Thank you in advance

- Dudely
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      11th Nov 2008
Looks like you have a typo, 66 vs 65

Try this too -

Sub test()
Dim i As Long, j As Long, k As Long
Dim Subject As String

Subject = "Auction"

For j = 0 To 1
k = 32 * j
For i = 65 To 65 + 26
sfind = Replace("&#num;", "num", CStr(i + k))
Subject = Replace(Subject, sfind, Chr$(i + k))
Next
Next
MsgBox Subject ' Auction
End Sub

Regards,
Peter T

"Dudely" <(E-Mail Removed)> wrote in message
news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)...
>I pull a text string off a web page, that contains some random text.
> From time to time, the string will contain a mixture of ASCII and ISO
> encoded characters. Sample below.
>
> I'm unable to get any function to recognize the string.
>
> I'm using VBA 6.0 with Excel 2000
>
> Example code:
>
> Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"
>
> Subject = Replace(Subject, "&#66;", "A")
>
> I've also tried every other character that should be in that string.
>
> The replacement never takes place, the string is unmodified. I've
> also tried searching for just "&#" but it never finds that either.
> I've tried using InStr as well but that fails to find a match too.
> The goal is of course to dechiper the (random) string into it's ASCII
> equivalent (so that it can be read by a human).
>
> Any help?
>
> Thank you in advance
>
> - Dudely



 
Reply With Quote
 
Dudely
Guest
Posts: n/a
 
      12th Nov 2008
Yes, the typo was in the post, not in the original code.

I didn't quite understand what you were doing, so I changed your code
a bit to:

For i = 48 To 127
sfind = Replace("&#num;", "num", CStr(i))
Subject = Replace(Subject, sfind, Chr$(i))
Next
which I believe captures the essence of what you were doing. The
target string could be almost anything and must be able to handle any
character. For the moment, I'm assuming the ASCII character set to be
sufficient, but in truth there's nothing to prevent someone from using
alphanum characters outside that range as well.

In any event, while the sample string works, live data continues to
fail.

What I'd prefer to do, is setup a "capture", because it walks through
a LOT of data before it gets to one of these encoded text strings and
I'd rather not have to check every single iteration to see if it has
one of the target strings.

What I mean is that instead of trying to fix it first, I'd prefer to
find and capture the text. Then later a similar method can be used to
replace the target string.

So instead of the above, it might say something like:

if inStr(1, Subject, "&#") then
msgBox "Found " + Subject
endif

Something like that. Note, that I tried something like that and it
also failed.

Thank you most kindly for your help.

- Dudely

On Nov 11, 12:18*am, "Peter T" <peter_t@discussions> wrote:
> Looks like you have a typo, 66 vs 65
>
> Try this too -
>
> Sub test()
> Dim i As Long, j As Long, k As Long
> Dim Subject As String
>
> * * Subject = "&#65;&#117;&#99;&#116;&#105;&#111;n"
>
> * * For j = 0 To 1
> * * * * k = 32 * j
> * * * * For i = 65 To 65 + 26
> * * * * * * sfind = Replace("&#num;", "num", CStr(i + k))
> * * * * * * Subject = Replace(Subject, sfind, Chr$(i + k))
> * * * * Next
> * * Next
> * * MsgBox Subject ' Auction
> End Sub
>
> Regards,
> Peter T
>
> "Dudely" <ab3...@gmail.com> wrote in message
>
> news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)...
>
>
>
> >I pull a text string off a web page, that contains some random text.
> > From time to time, the string will contain a mixture of ASCII and ISO
> > encoded characters. *Sample below.

>
> > I'm unable to get any function to recognize the string.

>
> > I'm using VBA 6.0 with Excel 2000

>
> > Example code:

>
> > Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > Subject = Replace(Subject, "&#66;", "A")

>
> > I've also tried every other character that should be in that string.

>
> > The replacement never takes place, the string is unmodified. *I've
> > also tried searching for just "&#" but it never finds that either.
> > I've tried using InStr as well but that fails to find a match too.
> > The goal is of course to dechiper the (random) string into it's ASCII
> > equivalent (so that it can be read by a human).

>
> > Any help?

>
> > Thank you in advance

>
> > - Dudely- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      12th Nov 2008
The double loop I posted processed char codes 65-90 and 97-122, ie A-Z,a-z.

Even with the limited information and typo you posted it appeared to
successfully decode your sample string.

If it fails to decode different sample data, it's impossible for anyone to
assist without that data, and ideally what the sample should decode as
(doesn't look like it's encrypted).

Regards,
Peter T



"Dudely" <(E-Mail Removed)> wrote in message
news:8006a934-6ef7-46d3-8912-(E-Mail Removed)...
Yes, the typo was in the post, not in the original code.

I didn't quite understand what you were doing, so I changed your code
a bit to:

For i = 48 To 127
sfind = Replace("&#num;", "num", CStr(i))
Subject = Replace(Subject, sfind, Chr$(i))
Next
which I believe captures the essence of what you were doing. The
target string could be almost anything and must be able to handle any
character. For the moment, I'm assuming the ASCII character set to be
sufficient, but in truth there's nothing to prevent someone from using
alphanum characters outside that range as well.

In any event, while the sample string works, live data continues to
fail.

What I'd prefer to do, is setup a "capture", because it walks through
a LOT of data before it gets to one of these encoded text strings and
I'd rather not have to check every single iteration to see if it has
one of the target strings.

What I mean is that instead of trying to fix it first, I'd prefer to
find and capture the text. Then later a similar method can be used to
replace the target string.

So instead of the above, it might say something like:

if inStr(1, Subject, "&#") then
msgBox "Found " + Subject
endif

Something like that. Note, that I tried something like that and it
also failed.

Thank you most kindly for your help.

- Dudely

On Nov 11, 12:18 am, "Peter T" <peter_t@discussions> wrote:
> Looks like you have a typo, 66 vs 65
>
> Try this too -
>
> Sub test()
> Dim i As Long, j As Long, k As Long
> Dim Subject As String
>
> Subject = "&#65;&#117;&#99;&#116;&#105;&#111;n"
>
> For j = 0 To 1
> k = 32 * j
> For i = 65 To 65 + 26
> sfind = Replace("&#num;", "num", CStr(i + k))
> Subject = Replace(Subject, sfind, Chr$(i + k))
> Next
> Next
> MsgBox Subject ' Auction
> End Sub
>
> Regards,
> Peter T
>
> "Dudely" <ab3...@gmail.com> wrote in message
>
> news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)...
>
>
>
> >I pull a text string off a web page, that contains some random text.
> > From time to time, the string will contain a mixture of ASCII and ISO
> > encoded characters. Sample below.

>
> > I'm unable to get any function to recognize the string.

>
> > I'm using VBA 6.0 with Excel 2000

>
> > Example code:

>
> > Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > Subject = Replace(Subject, "&#66;", "A")

>
> > I've also tried every other character that should be in that string.

>
> > The replacement never takes place, the string is unmodified. I've
> > also tried searching for just "&#" but it never finds that either.
> > I've tried using InStr as well but that fails to find a match too.
> > The goal is of course to dechiper the (random) string into it's ASCII
> > equivalent (so that it can be read by a human).

>
> > Any help?

>
> > Thank you in advance

>
> > - Dudely- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Dudely
Guest
Posts: n/a
 
      16th Nov 2008
Thanks for your response. Here is a cut & paste of another sample
string retrieved.

&#66;a&#110;k S&#101;ized

I've changed your code to do the following:

For i = 0 To 255
sfind = Replace("&#num;", "num", CStr(i))
Subject = Replace(Subject, sfind, Chr$(i))
Next

When the string is copied to a static variable; i.e.
str="&#66;a&#110;k S&#101;ized" for the purposes of testing, then
there is no problem.
However, when I pull it directly off the web page by accessing the
DOM, and then parse it like so: Subject = Mid(el, theSpot + 8), the
above code fails to make the replacement. Note that "el" is of type
variant. Perhaps this has something to do with it? Subject is of
type String.

Thank you again for your help.


On Nov 12, 1:50*am, "Peter T" <peter_t@discussions> wrote:
> The double loop I posted processed char codes 65-90 and 97-122, ie A-Z,a-z.
>
> Even with the limited information and typo you posted it appeared to
> successfully decode your sample string.
>
> If it fails to decode different sample data, it's impossible for anyone to
> assist without that data, and ideally what the sample should decode as
> (doesn't look like it's encrypted).
>
> Regards,
> Peter T
>
> "Dudely" <ab3...@gmail.com> wrote in message
>
> news:8006a934-6ef7-46d3-8912-(E-Mail Removed)...
> Yes, the typo was in the post, not in the original code.
>
> I didn't quite understand what you were doing, so I changed your code
> a bit to:
>
> * * * * For i = 48 To 127
> * * * * * * sfind = Replace("&#num;", "num", CStr(i))
> * * * * * * Subject = Replace(Subject, sfind, Chr$(i))
> * * * * Next
> which I believe captures the essence of what you were doing. *The
> target string could be almost anything and must be able to handle any
> character. *For the moment, I'm assuming the ASCII character set to be
> sufficient, but in truth there's nothing to prevent someone from using
> alphanum characters outside that range as well.
>
> In any event, while the sample string works, live data continues to
> fail.
>
> What I'd prefer to do, is setup a "capture", because it walks through
> a LOT of data before it gets to one of these encoded text strings and
> I'd rather not have to check every single iteration to see if it has
> one of the target strings.
>
> What I mean is that instead of trying to fix it first, I'd prefer to
> find and capture the text. *Then later a similar method can be used to
> replace the target string.
>
> So instead of the above, it might say something like:
>
> if inStr(1, Subject, "&#") then
> msgBox "Found " + Subject
> endif
>
> Something like that. *Note, that I tried something like that and it
> also failed.
>
> Thank you most kindly for your help.
>
> - Dudely
>
> On Nov 11, 12:18 am, "Peter T" <peter_t@discussions> wrote:
>
>
>
> > Looks like you have a typo, 66 vs 65

>
> > Try this too -

>
> > Sub test()
> > Dim i As Long, j As Long, k As Long
> > Dim Subject As String

>
> > Subject = "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > For j = 0 To 1
> > k = 32 * j
> > For i = 65 To 65 + 26
> > sfind = Replace("&#num;", "num", CStr(i + k))
> > Subject = Replace(Subject, sfind, Chr$(i + k))
> > Next
> > Next
> > MsgBox Subject ' Auction
> > End Sub

>
> > Regards,
> > Peter T

>
> > "Dudely" <ab3...@gmail.com> wrote in message

>
> >news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)...

>
> > >I pull a text string off a web page, that contains some random text.
> > > From time to time, the string will contain a mixture of ASCII and ISO
> > > encoded characters. Sample below.

>
> > > I'm unable to get any function to recognize the string.

>
> > > I'm using VBA 6.0 with Excel 2000

>
> > > Example code:

>
> > > Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > > Subject = Replace(Subject, "&#66;", "A")

>
> > > I've also tried every other character that should be in that string.

>
> > > The replacement never takes place, the string is unmodified. I've
> > > also tried searching for just "&#" but it never finds that either.
> > > I've tried using InStr as well but that fails to find a match too.
> > > The goal is of course to dechiper the (random) string into it's ASCII
> > > equivalent (so that it can be read by a human).

>
> > > Any help?

>
> > > Thank you in advance

>
> > > - Dudely- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      16th Nov 2008
What is the Subject string after doing this

Subject = Mid(el, theSpot + 8)

What is the string value of 'el' and the numeric value of 'theSpot'

Regards,
Peter T


"Dudely" <(E-Mail Removed)> wrote in message
news:1866ec06-e510-40d3-ab15-(E-Mail Removed)...
Thanks for your response. Here is a cut & paste of another sample
string retrieved.

&#66;a&#110;k S&#101;ized

I've changed your code to do the following:

For i = 0 To 255
sfind = Replace("&#num;", "num", CStr(i))
Subject = Replace(Subject, sfind, Chr$(i))
Next

When the string is copied to a static variable; i.e.
str="&#66;a&#110;k S&#101;ized" for the purposes of testing, then
there is no problem.
However, when I pull it directly off the web page by accessing the
DOM, and then parse it like so: Subject = Mid(el, theSpot + 8), the
above code fails to make the replacement. Note that "el" is of type
variant. Perhaps this has something to do with it? Subject is of
type String.

Thank you again for your help.


On Nov 12, 1:50 am, "Peter T" <peter_t@discussions> wrote:
> The double loop I posted processed char codes 65-90 and 97-122, ie
> A-Z,a-z.
>
> Even with the limited information and typo you posted it appeared to
> successfully decode your sample string.
>
> If it fails to decode different sample data, it's impossible for anyone to
> assist without that data, and ideally what the sample should decode as
> (doesn't look like it's encrypted).
>
> Regards,
> Peter T
>
> "Dudely" <ab3...@gmail.com> wrote in message
>
> news:8006a934-6ef7-46d3-8912-(E-Mail Removed)...
> Yes, the typo was in the post, not in the original code.
>
> I didn't quite understand what you were doing, so I changed your code
> a bit to:
>
> For i = 48 To 127
> sfind = Replace("&#num;", "num", CStr(i))
> Subject = Replace(Subject, sfind, Chr$(i))
> Next
> which I believe captures the essence of what you were doing. The
> target string could be almost anything and must be able to handle any
> character. For the moment, I'm assuming the ASCII character set to be
> sufficient, but in truth there's nothing to prevent someone from using
> alphanum characters outside that range as well.
>
> In any event, while the sample string works, live data continues to
> fail.
>
> What I'd prefer to do, is setup a "capture", because it walks through
> a LOT of data before it gets to one of these encoded text strings and
> I'd rather not have to check every single iteration to see if it has
> one of the target strings.
>
> What I mean is that instead of trying to fix it first, I'd prefer to
> find and capture the text. Then later a similar method can be used to
> replace the target string.
>
> So instead of the above, it might say something like:
>
> if inStr(1, Subject, "&#") then
> msgBox "Found " + Subject
> endif
>
> Something like that. Note, that I tried something like that and it
> also failed.
>
> Thank you most kindly for your help.
>
> - Dudely
>
> On Nov 11, 12:18 am, "Peter T" <peter_t@discussions> wrote:
>
>
>
> > Looks like you have a typo, 66 vs 65

>
> > Try this too -

>
> > Sub test()
> > Dim i As Long, j As Long, k As Long
> > Dim Subject As String

>
> > Subject = "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > For j = 0 To 1
> > k = 32 * j
> > For i = 65 To 65 + 26
> > sfind = Replace("&#num;", "num", CStr(i + k))
> > Subject = Replace(Subject, sfind, Chr$(i + k))
> > Next
> > Next
> > MsgBox Subject ' Auction
> > End Sub

>
> > Regards,
> > Peter T

>
> > "Dudely" <ab3...@gmail.com> wrote in message

>
> >news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)...

>
> > >I pull a text string off a web page, that contains some random text.
> > > From time to time, the string will contain a mixture of ASCII and ISO
> > > encoded characters. Sample below.

>
> > > I'm unable to get any function to recognize the string.

>
> > > I'm using VBA 6.0 with Excel 2000

>
> > > Example code:

>
> > > Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > > Subject = Replace(Subject, "&#66;", "A")

>
> > > I've also tried every other character that should be in that string.

>
> > > The replacement never takes place, the string is unmodified. I've
> > > also tried searching for just "&#" but it never finds that either.
> > > I've tried using InStr as well but that fails to find a match too.
> > > The goal is of course to dechiper the (random) string into it's ASCII
> > > equivalent (so that it can be read by a human).

>
> > > Any help?

>
> > > Thank you in advance

>
> > > - Dudely- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Dudely
Guest
Posts: n/a
 
      16th Nov 2008
The string value of el is composed of letters & numbers that make up
an email address, +1. It comes in the form of: *@*.* and is composed
of a random number of characters followed by ?subject= followed by the
actual subject string. The value of theSpot is equal to the number of
characters in the email address. If in fact the email address were
(E-Mail Removed), then the corresponding values would be:

el.value=mailto(E-Mail Removed)?subject=&#66;a&#110;k
S&#101;ized
theSpot=the number of characters between the start of the value and
the word "subject" and is obtained by the expression: theSpot = InStr
(el, "subject")
The subject string=&#66;a&#110;k S&#101;ized

On Nov 16, 2:11*am, "Peter T" <peter_t@discussions> wrote:
> What is the Subject string after doing this
>
> Subject = Mid(el, theSpot + 8)
>
> What is the string value of 'el' and the numeric value of 'theSpot'
>
> Regards,
> Peter T
>
> "Dudely" <ab3...@gmail.com> wrote in message
>
> news:1866ec06-e510-40d3-ab15-(E-Mail Removed)...
> Thanks for your response. *Here is a cut & paste of another sample
> string retrieved.
>
> &#66;a&#110;k S&#101;ized
>
> I've changed your code to do the following:
>
> For *i = 0 To 255
> * * * * * * *sfind = Replace("&#num;", "num", CStr(i))
> * * * * * * *Subject = Replace(Subject, sfind, Chr$(i))
> Next
>
> When the string is copied to a static variable; i.e.
> str="&#66;a&#110;k S&#101;ized" for the purposes of testing, then
> there is no problem.
> However, when I pull it directly off the web page by accessing the
> DOM, and then parse it like so: *Subject = Mid(el, theSpot + 8), the
> above code fails to make the replacement. *Note that "el" is of type
> variant. *Perhaps this has something to do with it? *Subject is of
> type String.
>
> Thank you again for your help.
>
> On Nov 12, 1:50 am, "Peter T" <peter_t@discussions> wrote:
>
>
>
> > The double loop I posted processed char codes 65-90 and 97-122, ie
> > A-Z,a-z.

>
> > Even with the limited information and typo you posted it appeared to
> > successfully decode your sample string.

>
> > If it fails to decode different sample data, it's impossible for anyoneto
> > assist without that data, and ideally what the sample should decode as
> > (doesn't look like it's encrypted).

>
> > Regards,
> > Peter T

>
> > "Dudely" <ab3...@gmail.com> wrote in message

>
> >news:8006a934-6ef7-46d3-8912-(E-Mail Removed)....
> > Yes, the typo was in the post, not in the original code.

>
> > I didn't quite understand what you were doing, so I changed your code
> > a bit to:

>
> > For i = 48 To 127
> > sfind = Replace("&#num;", "num", CStr(i))
> > Subject = Replace(Subject, sfind, Chr$(i))
> > Next
> > which I believe captures the essence of what you were doing. The
> > target string could be almost anything and must be able to handle any
> > character. For the moment, I'm assuming the ASCII character set to be
> > sufficient, but in truth there's nothing to prevent someone from using
> > alphanum characters outside that range as well.

>
> > In any event, while the sample string works, live data continues to
> > fail.

>
> > What I'd prefer to do, is setup a "capture", because it walks through
> > a LOT of data before it gets to one of these encoded text strings and
> > I'd rather not have to check every single iteration to see if it has
> > one of the target strings.

>
> > What I mean is that instead of trying to fix it first, I'd prefer to
> > find and capture the text. Then later a similar method can be used to
> > replace the target string.

>
> > So instead of the above, it might say something like:

>
> > if inStr(1, Subject, "&#") then
> > msgBox "Found " + Subject
> > endif

>
> > Something like that. Note, that I tried something like that and it
> > also failed.

>
> > Thank you most kindly for your help.

>
> > - Dudely

>
> > On Nov 11, 12:18 am, "Peter T" <peter_t@discussions> wrote:

>
> > > Looks like you have a typo, 66 vs 65

>
> > > Try this too -

>
> > > Sub test()
> > > Dim i As Long, j As Long, k As Long
> > > Dim Subject As String

>
> > > Subject = "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > > For j = 0 To 1
> > > k = 32 * j
> > > For i = 65 To 65 + 26
> > > sfind = Replace("&#num;", "num", CStr(i + k))
> > > Subject = Replace(Subject, sfind, Chr$(i + k))
> > > Next
> > > Next
> > > MsgBox Subject ' Auction
> > > End Sub

>
> > > Regards,
> > > Peter T

>
> > > "Dudely" <ab3...@gmail.com> wrote in message

>
> > >news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)....

>
> > > >I pull a text string off a web page, that contains some random text.
> > > > From time to time, the string will contain a mixture of ASCII and ISO
> > > > encoded characters. Sample below.

>
> > > > I'm unable to get any function to recognize the string.

>
> > > > I'm using VBA 6.0 with Excel 2000

>
> > > > Example code:

>
> > > > Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > > > Subject = Replace(Subject, "&#66;", "A")

>
> > > > I've also tried every other character that should be in that string..

>
> > > > The replacement never takes place, the string is unmodified. I've
> > > > also tried searching for just "&#" but it never finds that either.
> > > > I've tried using InStr as well but that fails to find a match too.
> > > > The goal is of course to dechiper the (random) string into it's ASCII
> > > > equivalent (so that it can be read by a human).

>
> > > > Any help?

>
> > > > Thank you in advance

>
> > > > - Dudely- Hide quoted text -

>
> > > - Show quoted text -- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      16th Nov 2008
On Sun, 16 Nov 2008 09:00:24 -0800 (PST), Dudely <(E-Mail Removed)> wrote:

>The string value of el is composed of letters & numbers that make up
>an email address, +1. It comes in the form of: *@*.* and is composed
>of a random number of characters followed by ?subject= followed by the
>actual subject string. The value of theSpot is equal to the number of
>characters in the email address. If in fact the email address were
>(E-Mail Removed), then the corresponding values would be:
>
>el.value=mailto(E-Mail Removed)?subject=&#66;a&#110;k
>S&#101;ized
>theSpot=the number of characters between the start of the value and
>the word "subject" and is obtained by the expression: theSpot = InStr
>(el, "subject")
>The subject string=&#66;a&#110;k S&#101;ized
>


I suspect something odd about the code you have not posted. Perhaps if you
posted all of your code, and not just bits and pieces, it might be helpful.

The following seems to work as expected:

=====================
Option Explicit
Const e1 As String = _
"mailto(E-Mail Removed)?subject=&#66;a&#110;k S&#101;ized"

Sub foo()
Dim SubjectString As String
Dim i As Long
Dim theSpot As Long
theSpot = InStr(e1, "subject")
SubjectString = Mid(e1, theSpot + 8)

For i = 32 To 127
SubjectString = Replace(SubjectString, "&#" & i & ";", Chr(i))
Next i

Debug.Print SubjectString

End Sub
====================
--ron
 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      16th Nov 2008
On Sun, 16 Nov 2008 09:00:24 -0800 (PST), Dudely <(E-Mail Removed)> wrote:

>The string value of el is composed of letters & numbers that make up
>an email address, +1. It comes in the form of: *@*.* and is composed
>of a random number of characters followed by ?subject= followed by the
>actual subject string. The value of theSpot is equal to the number of
>characters in the email address. If in fact the email address were
>(E-Mail Removed), then the corresponding values would be:
>
>el.value=mailto(E-Mail Removed)?subject=&#66;a&#110;k
>S&#101;ized
>theSpot=the number of characters between the start of the value and
>the word "subject" and is obtained by the expression: theSpot = InStr
>(el, "subject")
>The subject string=&#66;a&#110;k S&#101;ized


As I mentioned -- something in your code.

The above code, which you did post, is ambiguous.

You mention in a previous post that e1 is of type variant. That being the
case, e1.value is not valid and should be giving you an error.
--ron
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      17th Nov 2008
Ron has more than covered anything I can add in response, in particular el
vs el.value

FWIW you should be able to pass the original string to the de-crypt routine
and return a sensible result (ie before parsing with InStr)

Regards,
Peter T

"Dudely" <(E-Mail Removed)> wrote in message
news:8f2c3fcf-7bdf-47b5-b5fe-(E-Mail Removed)...
The string value of el is composed of letters & numbers that make up
an email address, +1. It comes in the form of: *@*.* and is composed
of a random number of characters followed by ?subject= followed by the
actual subject string. The value of theSpot is equal to the number of
characters in the email address. If in fact the email address were
(E-Mail Removed), then the corresponding values would be:

el.value=mailto(E-Mail Removed)?subject=&#66;a&#110;k
S&#101;ized
theSpot=the number of characters between the start of the value and
the word "subject" and is obtained by the expression: theSpot = InStr
(el, "subject")
The subject string=&#66;a&#110;k S&#101;ized

On Nov 16, 2:11 am, "Peter T" <peter_t@discussions> wrote:
> What is the Subject string after doing this
>
> Subject = Mid(el, theSpot + 8)
>
> What is the string value of 'el' and the numeric value of 'theSpot'
>
> Regards,
> Peter T
>
> "Dudely" <ab3...@gmail.com> wrote in message
>
> news:1866ec06-e510-40d3-ab15-(E-Mail Removed)...
> Thanks for your response. Here is a cut & paste of another sample
> string retrieved.
>
> &#66;a&#110;k S&#101;ized
>
> I've changed your code to do the following:
>
> For i = 0 To 255
> sfind = Replace("&#num;", "num", CStr(i))
> Subject = Replace(Subject, sfind, Chr$(i))
> Next
>
> When the string is copied to a static variable; i.e.
> str="&#66;a&#110;k S&#101;ized" for the purposes of testing, then
> there is no problem.
> However, when I pull it directly off the web page by accessing the
> DOM, and then parse it like so: Subject = Mid(el, theSpot + 8), the
> above code fails to make the replacement. Note that "el" is of type
> variant. Perhaps this has something to do with it? Subject is of
> type String.
>
> Thank you again for your help.
>
> On Nov 12, 1:50 am, "Peter T" <peter_t@discussions> wrote:
>
>
>
> > The double loop I posted processed char codes 65-90 and 97-122, ie
> > A-Z,a-z.

>
> > Even with the limited information and typo you posted it appeared to
> > successfully decode your sample string.

>
> > If it fails to decode different sample data, it's impossible for anyone
> > to
> > assist without that data, and ideally what the sample should decode as
> > (doesn't look like it's encrypted).

>
> > Regards,
> > Peter T

>
> > "Dudely" <ab3...@gmail.com> wrote in message

>
> >news:8006a934-6ef7-46d3-8912-(E-Mail Removed)...
> > Yes, the typo was in the post, not in the original code.

>
> > I didn't quite understand what you were doing, so I changed your code
> > a bit to:

>
> > For i = 48 To 127
> > sfind = Replace("&#num;", "num", CStr(i))
> > Subject = Replace(Subject, sfind, Chr$(i))
> > Next
> > which I believe captures the essence of what you were doing. The
> > target string could be almost anything and must be able to handle any
> > character. For the moment, I'm assuming the ASCII character set to be
> > sufficient, but in truth there's nothing to prevent someone from using
> > alphanum characters outside that range as well.

>
> > In any event, while the sample string works, live data continues to
> > fail.

>
> > What I'd prefer to do, is setup a "capture", because it walks through
> > a LOT of data before it gets to one of these encoded text strings and
> > I'd rather not have to check every single iteration to see if it has
> > one of the target strings.

>
> > What I mean is that instead of trying to fix it first, I'd prefer to
> > find and capture the text. Then later a similar method can be used to
> > replace the target string.

>
> > So instead of the above, it might say something like:

>
> > if inStr(1, Subject, "&#") then
> > msgBox "Found " + Subject
> > endif

>
> > Something like that. Note, that I tried something like that and it
> > also failed.

>
> > Thank you most kindly for your help.

>
> > - Dudely

>
> > On Nov 11, 12:18 am, "Peter T" <peter_t@discussions> wrote:

>
> > > Looks like you have a typo, 66 vs 65

>
> > > Try this too -

>
> > > Sub test()
> > > Dim i As Long, j As Long, k As Long
> > > Dim Subject As String

>
> > > Subject = "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > > For j = 0 To 1
> > > k = 32 * j
> > > For i = 65 To 65 + 26
> > > sfind = Replace("&#num;", "num", CStr(i + k))
> > > Subject = Replace(Subject, sfind, Chr$(i + k))
> > > Next
> > > Next
> > > MsgBox Subject ' Auction
> > > End Sub

>
> > > Regards,
> > > Peter T

>
> > > "Dudely" <ab3...@gmail.com> wrote in message

>
> > >news:f1da081c-c0c3-41a5-8204-(E-Mail Removed)...

>
> > > >I pull a text string off a web page, that contains some random text.
> > > > From time to time, the string will contain a mixture of ASCII and
> > > > ISO
> > > > encoded characters. Sample below.

>
> > > > I'm unable to get any function to recognize the string.

>
> > > > I'm using VBA 6.0 with Excel 2000

>
> > > > Example code:

>
> > > > Subject= "&#65;&#117;&#99;&#116;&#105;&#111;n"

>
> > > > Subject = Replace(Subject, "&#66;", "A")

>
> > > > I've also tried every other character that should be in that string.

>
> > > > The replacement never takes place, the string is unmodified. I've
> > > > also tried searching for just "&#" but it never finds that either.
> > > > I've tried using InStr as well but that fails to find a match too.
> > > > The goal is of course to dechiper the (random) string into it's
> > > > ASCII
> > > > equivalent (so that it can be read by a human).

>
> > > > Any help?

>
> > > > Thank you in advance

>
> > > > - Dudely- Hide quoted text -

>
> > > - Show quoted text -- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine if a string is Base64 encoded or not? Greg Microsoft C# .NET 2 17th Jun 2009 11:06 PM
SQL connection string encoded in a Uri? Lou Microsoft Dot NET 5 28th Nov 2008 06:46 PM
Write utf8 encoded string Samuel Microsoft VB .NET 5 1st Aug 2008 10:30 AM
How to decode this partially encoded string? John Dalberg Microsoft ASP .NET 2 8th Mar 2007 06:27 PM
How can I decode a string encoded into 8859-1 ? Olivier Microsoft Dot NET Framework 1 1st Dec 2004 06:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:22 AM.