Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird error..

Status
Not open for further replies.

adamsoderqvist

Programmer
Sep 8, 2001
136
SE
Hi,

I get this err msg, which I haven't recieved before:

"Sun ONE ASP VBScript runtime (0x800A4001)
Function or method call not implemented: 'ChrB'"

The code is placed on a web hotell that I haven't used before, but the code works fine with my earlier web hotel..

The ASP code is:

"Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)"

Anyone got a clue?

/
 
They are not using IIS... they are running Chili-soft
 
Here is an excerpt from a helpful page I found on google:

Code:
...

----------------------------------------------    
4.5 Functions - VBScript
----------------------------------------------

4.5.1 VBSCRIPT FUNCTIONS
The behavior of VBScript functions such as MidB, ChrB,
LeftB, and AscB depends on the byte ordering of the
hardware platform, and the number of bytes used to
represent Unicode characters in the system software.
The functions will produce different results on
different operating systems.

...

The rest of the page is here:
That page might warn you of other problems that you will find in the future....
 
OK... so what to when the error occurs: I don't have any training in Apache. There should be an easy workaroud, or..?

/A
 
The easy workaround is to re-write the code or move to another host server.

Re-writing might not be too hard... it looks like the separator is everything on the first line up to, but no including the Carriage return.
 
OK, so a solution could be to re-write the carriage return to something more Chilli-friendly..?

Anyone got an idea on how that would look? (very basic, I know.. But I'm still lost since I don't do apache code)

/
 
What does this code do?

If I had to take a guess then I'd say it is for parsing the HTTP Request sent by the client. The most common reason to do this would be for file uploads.

The reason that I'm asking is that the easiest thing to do may actually be to find a different method for accomplishing the same task, rather than re-writing the code.

Anyway, if you are going to re-write it then you need to know two things:
1. Will the data be in normal ASCII or Unicode? (1 or 2 bytes per char)
2. Is the underlying OS little or big endian? (high bit on left or right)

One little, two little, three little Endian...

Consider the character for uppercase "A"
The ASCII code is 65.
The byte representation is:
01000001 - normal little endian
10000010 - normal big endian
0000000001000001 - unicode little endian
1000001000000000 - unicode big endian

 
Isn't your Unicode big and little endian mixed up? I thought that Unicode used a character code system that is 64K, which means the MSB for "A" would be 00000000 and the LSB would be 01000001. Little endian would be 0100000100000000 and big endian would be 0000000001000001. Or have I misunderstood Unicode characters?

As well, for an 8-bit byte, I thought that big and little endian would be the same, and endian-ness only comes into play when a number takes up more than one byte.

Lee
 
You are probably right.

I'm working off a vague memory of some nasty byte ordering problems I writing a program that ran on NT 3.51 for the DEC Alpha platform.

The program did digital image aquisition from a CaT Scan machine and then passed the image to a Sun Sparc for processing and 3d reconstruction. The pictures were very screwed up until I figured out the byte order problem...
 
Sheco!

You're right - it's an uploading code!

And the code is in ACII. So the upload should be "clean", but I still get the error (that doesn't appear on an alternative/IIS server).

The full code (for the sub that's trubbeling, but there is more..) is:

************* BEGIN CODE **************

Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)


Dim lenSeparator
lenSeparator = LenB(separator)

Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""

While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos

If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)

Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scripting.Dictionary")

begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos

Dim nameN
nameN = MidB(value, begPos, endPos - begPos)

Dim nameValue, isValid
isValid = True

If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))

If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue))

begPos = 14 + InStrB(endPos + 1, value, stringToByte("Content-Type:"))
endPos = InStrB(begPos, value, ChrB(13))

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue))

begPos = endPos + 4
endPos = LenB(value)

nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(value, nValue + 5)))
End If

If isValid = True Then

intDict.Add "Value", nameValue
intDict.Add "Name", nameN

dict.Add byteToString(nameN), intDict
End If
End If

currentPos = lenSeparator + inStrByte
Wend
End Sub

************* END CODE **************

I guess that Apache don't "take" the carriage return as I'm presenting it here, but I'm not very eager to re-write it all either (since it's working on an IIS server..).

Any suggestions?

And I'm really very greatfull for all your help! Thanx everyone

/
 
Oh I was it would be an upload script...

Any possibility that this server will allow you to load a COM object? I know those Windows things but it looks like this code you posted also requires Scripting.Dictionary and I bet that elsewhere on the site you probably use something like Scripting.FileSystemObject or ADODB.Recordset

The reason that I ask is that the easiest thing to do would be to just copy the entire function into a VB 6 ActiveX DLL project and compile it into an object that you can call from inside the ASP function.

When you say the code is in ASCII do you mean that your upload is always a text file or that it is MIME encoded?
 
Yep, I use the Scripting.FileSystemObject..

No, the file is MIME encoded (pictures)!

Will the code really work if the only thing I do is placing it in a DLL? - The function is still the same, or..?

/
 
Dangit... I was looking at the SUN FAQ and it says
Unfortunately, Visual Basic objects cannot be ported due to the lack of a Visual Basic run-time environment on UNIX/Linux.

So I guess the answer is no. It looks like they are just simulating the most common objects like FSO and ADO.

But I was poking around some more and I found this PDF datasheet:
On the second page in the bottom right hand corner it seems to say that they have a custom File Upload object that you can use.

So I looked at the online docs and found this:
It says something to the effect that the Upload component needs to be enabled on the server so I guess to test it you should see if you can do this:

Of course you could just change all function calls from their byte versions to the normal ones and see what happens...
InstrB() -> Instr()
MidB() - > Mid()
ChrB() -> Chr()

... but you'd prolly still end up having to tweak something and still might hit a dead end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top