chr() not working for values over 128 
Author Message
 chr() not working for values over 128

simple assignment:
   strTest = chr(253)

Starting this week, strTest receives strange results and
not the expected character.  Assigning values <=128, for
example, strTest = chr(126) works as expected.

The code was working until servers were upgraded w.
various IIS, and Windows 2000 security patches this past
weekend so most likely the problem is related to the
upgrade.

Has anyone else run into a problem with the values over
128?  I found a similar problem relating to MS Access but
haven't found anything related to asp, VBScript, etc.



Wed, 24 Aug 2005 03:47:31 GMT  
 chr() not working for values over 128

Quote:

> simple assignment:
>    strTest = chr(253)

> Starting this week, strTest receives strange results and
> not the expected character.  Assigning values <=128, for
> example, strTest = chr(126) works as expected.

> The code was working until servers were upgraded w.
> various IIS, and Windows 2000 security patches this past
> weekend so most likely the problem is related to the
> upgrade.

> Has anyone else run into a problem with the values over
> 128?  I found a similar problem relating to MS Access but
> haven't found anything related to asp, vbscript, etc.

Just a guess here.
Maybe you have just met up with the problem of internationalization.  'strTest = chr(253)' surely is giving you a character gives
you 235 if you display asc(strTest).  But what does chr(253) look like?  Go here and see tables for the various Windows-1259
charsets: http://www.microsoft.com/globaldev/reference/iso.mspx

Tell us a little more about what you are trying to do, what your locale is (use the setLocale function to get your current locale
and see Locale ID (LCID) Chart in the scripting help file script56.chm).

-Paul Randall



Wed, 24 Aug 2005 10:08:13 GMT  
 chr() not working for values over 128

Quote:




Quote:
> ... Go here and see tables for the various Windows-1259
> charsets: http://www.microsoft.com/globaldev/reference/iso.mspx

That's a cool link.
--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Thu, 25 Aug 2005 10:06:46 GMT  
 chr() not working for values over 128


Quote:


> > ... Go here and see tables for the various Windows-1259
> > charsets: http://www.microsoft.com/globaldev/reference/iso.mspx

> That's a cool link.

Hi, Alex

I'd like to see an HTA that allows you to select from a list of all the charsets/encodings installed on your computer and which then
builds and displays the HTML to display those kinds of tables.

-Paul Randall



Thu, 25 Aug 2005 12:14:51 GMT  
 chr() not working for values over 128
Quote:
>-----Original Message-----




Quote:
>> simple assignment:
>>    strTest = chr(253)

>> Starting this week, strTest receives strange results and
>> not the expected character.  Assigning values <=128, for
>> example, strTest = chr(126) works as expected.

>> The code was working until servers were upgraded w.
>> various IIS, and Windows 2000 security patches this past
>> weekend so most likely the problem is related to the
>> upgrade.

>> Has anyone else run into a problem with the values over
>> 128?  I found a similar problem relating to MS Access
but
>> haven't found anything related to asp, vbscript, etc.

>Just a guess here.
>Maybe you have just met up with the problem of

internationalization.  'strTest = chr(253)' surely is
giving you a character gives
Quote:
>you 235 if you display asc(strTest).  But what does chr

(253) look like?  Go here and see tables for the various
Windows-1259
Quote:
>charsets:

http://www.microsoft.com/globaldev/reference/iso.mspx
Quote:

>Tell us a little more about what you are trying to do,

what your locale is (use the setLocale function to get
your current locale

Quote:
>and see Locale ID (LCID) Chart in the scripting help file
script56.chm).

>-Paul Randall

>.

The statement is part of an asp page and it was working
prior to the application of the various patches.  I have
another machine on which the patches have not been applied
where the code still works.

Just to see what was happening, I put in some debug
statements.

The code is :
Dim strDelimeter
strDelimeter = Chr(253)

To debug, I entered the lines:
Dim strReverse
strReverse = Asc(strDelimeter)

I then output the values in both strings.

The asp page is launched from a "customer" page and the
customer id is one of the variables passed to the page.
When launched, for some reason, strDelimeter is set to the
first number in the customer id.  For example, launching
from customer 4321, strDelimeter is being set to 4 and
strReverse to 52.  When launched from customer 5311,
strDelimeter is being set to 5 and strReverse to 53.

The snippet of code is literally:
Dim strDelimeter
Dim strReverse
strDelimeter = Chr(253)
strReverse = Asc(strDelimeter)

and I am displaying the results immediately after the
assignments.

For curiousity, immediately after the declaration, I added
the line:
strDelimeter = ""

This caused the value of strDelimeter to change and
strDelimeter is usually a strange character (sometimes
chinese sometimes other) and strReverse is usually 1 with
occaisonally strDelimeter becoming "/" and strReverse
becoming 47.

As mentioned previously, the code works as expected on
servers which did not have the patches applied.



Sat, 27 Aug 2005 00:43:39 GMT  
 chr() not working for values over 128

Quote:
>-----Original Message-----




Quote:
>> simple assignment:
>>    strTest = chr(253)

>> Starting this week, strTest receives strange results and
>> not the expected character.  Assigning values <=128, for
>> example, strTest = chr(126) works as expected.

>> The code was working until servers were upgraded w.
>> various IIS, and Windows 2000 security patches this past
>> weekend so most likely the problem is related to the
>> upgrade.

>> Has anyone else run into a problem with the values over
>> 128?  I found a similar problem relating to MS Access
but
>> haven't found anything related to asp, vbscript, etc.

>Just a guess here.
>Maybe you have just met up with the problem of

internationalization.  'strTest = chr(253)' surely is
giving you a character gives
Quote:
>you 235 if you display asc(strTest).  But what does chr

(253) look like?  Go here and see tables for the various
Windows-1259
Quote:
>charsets:

http://www.microsoft.com/globaldev/reference/iso.mspx
Quote:

>Tell us a little more about what you are trying to do,

what your locale is (use the setLocale function to get
your current locale

Quote:
>and see Locale ID (LCID) Chart in the scripting help file
script56.chm).

>-Paul Randall

>.

Just to clarify further, I created the following sample
asp page on the servers causing trouble:


<% Option Explicit
   Response.Buffer = True
%>  
<html>
<head>
<title></title>
</head>
<body>

<%
dim strDelimeter
dim strReverse

strDelimeter = ""
strDelimeter = chr(253)
strReverse = asc(strDelimeter)
%>
Delimeter:<%=strDelimeter%>
Reverse:<%=strReverse%>

</BODY>
</HTML>

Loading the page created the following output:
Delimeter:??" Reverse:1

Refreshing the page created the following output:
Delimeter:. Reverse:46

3rd refresh:
Delimeter:??" Reverse:1

4th refresh:
Delimeter:o Reverse:111

Closing internet explorer and re-opening:
Delimeter:w Reverse:119

As you can see, this is extremely bizarre.

/John



Sat, 27 Aug 2005 01:03:40 GMT  
 chr() not working for values over 128

Quote:
>-----Original Message-----




Quote:
>> simple assignment:
>>    strTest = chr(253)

>> Starting this week, strTest receives strange results and
>> not the expected character.  Assigning values <=128, for
>> example, strTest = chr(126) works as expected.

>> The code was working until servers were upgraded w.
>> various IIS, and Windows 2000 security patches this past
>> weekend so most likely the problem is related to the
>> upgrade.

>> Has anyone else run into a problem with the values over
>> 128?  I found a similar problem relating to MS Access
but
>> haven't found anything related to asp, vbscript, etc.

>Just a guess here.
>Maybe you have just met up with the problem of

internationalization.  'strTest = chr(253)' surely is
giving you a character gives
Quote:
>you 235 if you display asc(strTest).  But what does chr

(253) look like?  Go here and see tables for the various
Windows-1259
Quote:
>charsets:

http://www.microsoft.com/globaldev/reference/iso.mspx
Quote:

>Tell us a little more about what you are trying to do,

what your locale is (use the setLocale function to get
your current locale

Quote:
>and see Locale ID (LCID) Chart in the scripting help file
script56.chm).

>-Paul Randall

>.

I threw in the test:
dim i
dim j
dim strTemp
for i = 0 to 255 step 8
 for j = 0 to 7
  strTemp = strTemp & (i + j) & "-" & asc(chr(i + j))
& "  "
 next
 strTemp = strTemp & vbcrlf
next

-------
All of the extended characters (128+) are showing a value
of 127.

0-0 1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9 10-10 11-11 12-12
13-13 14-14 15-15 16-16 17-17 18-18 19-19 20-20 21-21 22-
22 23-23 24-24 25-25 26-26 27-27 28-28 29-29 30-30 31-31
32-32 33-33 34-34 35-35 36-36 37-37 38-38 39-39 40-40 41-
41 42-42 43-43 44-44 45-45 46-46 47-47 48-48 49-49 50-50
51-51 52-52 53-53 54-54 55-55 56-56 57-57 58-58 59-59 60-
60 61-61 62-62 63-63 64-64 65-65 66-66 67-67 68-68 69-69
70-70 71-71 72-72 73-73 74-74 75-75 76-76 77-77 78-78 79-
79 80-80 81-81 82-82 83-83 84-84 85-85 86-86 87-87 88-88
89-89 90-90 91-91 92-92 93-93 94-94 95-95 96-96 97-97 98-
98 99-99 100-100 101-101 102-102 103-103 104-104 105-105
106-106 107-107 108-108 109-109 110-110 111-111 112-112
113-113 114-114 115-115 116-116 117-117 118-118 119-119
120-120 121-121 122-122 123-123 124-124 125-125 126-126
127-127 128-127 129-127 130-127 131-127 132-127 133-127
134-127 135-127 136-127 137-127 138-127 139-127 140-127
141-127 142-127 143-127 144-127 145-127 146-127 147-127
148-127 149-127 150-127 151-127 152-127 153-127 154-127
155-127 156-127 157-127 158-127 159-127 160-127 161-127
162-127 163-127 164-127 165-127 166-127 167-127 168-127
169-127 170-127 171-127 172-127 173-127 174-127 175-127
176-127 177-127 178-127 179-127 180-127 181-127 182-127
183-127 184-127 185-127 186-127 187-127 188-127 189-127
190-127 191-127 192-127 193-127 194-127 195-127 196-127
197-127 198-127 199-127 200-127 201-127 202-127 203-127
204-127 205-127 206-127 207-127 208-127 209-127 210-127
211-127 212-127 213-127 214-127 215-127 216-127 217-127
218-127 219-127 220-127 221-127 222-127 223-127 224-127
225-127 226-127 227-127 228-127 229-127 230-127 231-127
232-127 233-127 234-127 235-127 236-127 237-127 238-127
239-127 240-127 241-127 242-127 243-127 244-127 245-127
246-127 247-127 248-127 249-127 250-127 251-127 252-127
253-127 254-127 255-127

It is almost as if the extended characters have been
disabled.

/John



Sat, 27 Aug 2005 02:51:01 GMT  
 chr() not working for values over 128

Quote:

> I threw in the test:
> dim i
> dim j
> dim strTemp
> for i = 0 to 255 step 8
>  for j = 0 to 7
>   strTemp = strTemp & (i + j) & "-" & asc(chr(i + j))
> & "  "
>  next
>  strTemp = strTemp & vbcrlf
> next

> -------
> All of the extended characters (128+) are showing a value
> of 127.

> 0-0 1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9 10-10 11-11 12-12
> 13-13 14-14 15-15 16-16 17-17 18-18 19-19 20-20 21-21 22-
> 22 23-23 24-24 25-25 26-26 27-27 28-28 29-29 30-30 31-31
> 32-32 33-33 34-34 35-35 36-36 37-37 38-38 39-39 40-40 41-
> 41 42-42 43-43 44-44 45-45 46-46 47-47 48-48 49-49 50-50
> 51-51 52-52 53-53 54-54 55-55 56-56 57-57 58-58 59-59 60-
> 60 61-61 62-62 63-63 64-64 65-65 66-66 67-67 68-68 69-69
> 70-70 71-71 72-72 73-73 74-74 75-75 76-76 77-77 78-78 79-
> 79 80-80 81-81 82-82 83-83 84-84 85-85 86-86 87-87 88-88
> 89-89 90-90 91-91 92-92 93-93 94-94 95-95 96-96 97-97 98-
> 98 99-99 100-100 101-101 102-102 103-103 104-104 105-105
> 106-106 107-107 108-108 109-109 110-110 111-111 112-112
> 113-113 114-114 115-115 116-116 117-117 118-118 119-119
> 120-120 121-121 122-122 123-123 124-124 125-125 126-126
> 127-127 128-127 129-127 130-127 131-127 132-127 133-127
> 134-127 135-127 136-127 137-127 138-127 139-127 140-127
> 141-127 142-127 143-127 144-127 145-127 146-127 147-127
> 148-127 149-127 150-127 151-127 152-127 153-127 154-127
> 155-127 156-127 157-127 158-127 159-127 160-127 161-127
> 162-127 163-127 164-127 165-127 166-127 167-127 168-127
> 169-127 170-127 171-127 172-127 173-127 174-127 175-127
> 176-127 177-127 178-127 179-127 180-127 181-127 182-127
> 183-127 184-127 185-127 186-127 187-127 188-127 189-127
> 190-127 191-127 192-127 193-127 194-127 195-127 196-127
> 197-127 198-127 199-127 200-127 201-127 202-127 203-127
> 204-127 205-127 206-127 207-127 208-127 209-127 210-127
> 211-127 212-127 213-127 214-127 215-127 216-127 217-127
> 218-127 219-127 220-127 221-127 222-127 223-127 224-127
> 225-127 226-127 227-127 228-127 229-127 230-127 231-127
> 232-127 233-127 234-127 235-127 236-127 237-127 238-127
> 239-127 240-127 241-127 242-127 243-127 244-127 245-127
> 246-127 247-127 248-127 249-127 250-127 251-127 252-127
> 253-127 254-127 255-127

> It is almost as if the extended characters have been
> disabled.

> /John

Hi, John

Well, that is bizarre, which I don't know how to spell.

Code page 65001?  Is that UTF-8 multibyte characters?  Do you need to do chrW and ascW type stuff?

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemtextenc...

http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp?frame=true

-Paul Randall



Sat, 27 Aug 2005 05:18:52 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. ASCII 128-255 to 1-128 converter

2. Chr() not working with 2 variables in a loop

3. Chr(10) and Chr(13) doesn't work

4. Chr(10) not working?

5. CHR Function not working in VB 6

6. chr() and strconv() do not work consistently

7. Characters 128 to 255

8. The compiler failed with error code 128

9. MSCOMM and ASCII(128)

10. Error 128?

11. Want To read last 128 characters of a file

12. Project Specific Question: Reading first 128 bytes in an ICC Profile

 

 
Powered by phpBB® Forum Software