473,473 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Function in an include file misbehaving

26 New Member
I have this function:
Expand|Select|Wrap|Line Numbers
  1.  Function fixIt(text) 
  2. fixIt= Replace(Replace(Replace(text,"½","0.5"),"¼","0.25"),"¾","0.75")
  3. End Function
  4.  
If I place this function in the file that I am using, it works perfectly.

If I place the function in an include file, it will still change the fractions to decimals, but it also returns missing symbols (�) in front of the decimals.

Any ideas? Thanks.
Jun 29 '08 #1
10 1790
jhardman
3,406 Recognized Expert Specialist
I have this function:
Expand|Select|Wrap|Line Numbers
  1.  Function fixIt(text) 
  2. fixIt= Replace(Replace(Replace(text,"½","0.5"),"¼","0.25"),"¾","0.75")
  3. End Function
  4.  
If I place this function in the file that I am using, it works perfectly.

If I place the function in an include file, it will still change the fractions to decimals, but it also returns missing symbols (�) in front of the decimals.

Any ideas? Thanks.
What format is the text in the include file? Is it just a standard text file with a .inc extension? What program did you use to create it? Did you use the same program to create the ASP page?

Jared
Jul 1 '08 #2
liz0001
26 New Member
What format is the text in the include file? Is it just a standard text file with a .inc extension? What program did you use to create it? Did you use the same program to create the ASP page?

Jared

It has a .asp extension, and is written in asp between <% %> brackets. I have also tried with a .inc extension, and that yields the same results. I wrote it in text, and I am using DreamWeaver to interface.
Jul 2 '08 #3
jhardman
3,406 Recognized Expert Specialist
Try it this way, my best guess is there is some character confusion on dreamweaver's side that shows up when IIS pulls up the include file. This should clear it up.
Expand|Select|Wrap|Line Numbers
  1.  Function fixIt(text) 
  2. fixIt= Replace(Replace(Replace(text,chr(189),"0.5"),chr(188),"0.25"),chr(190),"0.75")
  3. End Function
  4.  
Let me know if this helps.

Jared
Jul 3 '08 #4
liz0001
26 New Member
Try it this way, my best guess is there is some character confusion on dreamweaver's side that shows up when IIS pulls up the include file. This should clear it up.
Expand|Select|Wrap|Line Numbers
  1.  Function fixIt(text) 
  2. fixIt= Replace(Replace(Replace(text,chr(189),"0.5"),chr(188),"0.25"),chr(190),"0.75")
  3. End Function
  4.  
Let me know if this helps.

Jared

Thanks, but this does the same thing. It will convert, but it will also stick an extra unknown character "�" in front of the decimal. Any other ideas?
Jul 5 '08 #5
jhardman
3,406 Recognized Expert Specialist
Thanks, but this does the same thing. It will convert, but it will also stick an extra unknown character "�" in front of the decimal. Any other ideas?
And this same function works if it's not in an include? That is a hard one.

Instead of copy/pasting the code, try retyping it completely.

You could also try splitting the multiple replace statements into different lines. Do each of these lines give the same problem?

Jared
Jul 8 '08 #6
liz0001
26 New Member
And this same function works if it's not in an include? That is a hard one.

Instead of copy/pasting the code, try retyping it completely.

You could also try splitting the multiple replace statements into different lines. Do each of these lines give the same problem?

Jared

Thanks Jared, but I tried it all. Nothing fixes it in the include file. And yes, it really does work if it's just in the same file. It has to be something funny with the special characters. They must be passed incorrectly.

Just an added random bit of info, running the characters through LCASE() completely replaces the special characters with the "missing character" diamond.
Jul 15 '08 #7
jhardman
3,406 Recognized Expert Specialist
Thanks Jared, but I tried it all. Nothing fixes it in the include file. And yes, it really does work if it's just in the same file. It has to be something funny with the special characters. They must be passed incorrectly.

Just an added random bit of info, running the characters through LCASE() completely replaces the special characters with the "missing character" diamond.
Replacing the special characters in the function with the ASP character codes (chr(188) etc) should rule out that possibility, if you use the character codes there are no special characters being passed through the include.

I don't know what to tell you. I just tried it on two different servers, and I can't replicate your problem. My best guess is that Dreamweaver is messing it up, and I don't even have Dreamweaver. Did I already suggest re-typing the function in Notepad? It might be time to look at alternative ways to solve the problem, but I'll ask a couple other experts.

Jared
Jul 16 '08 #8
asedt
125 New Member
You can use a HEX editor to check ot what the unknown charecter is, it sounds like it's some problems with the encodings, if thats the case the encodings in the two files don't match and the solution is to make them match or to change the "0.25" strings so they match the encoding of the document you whant to use it in. I'm just guessing.
Jul 16 '08 #9
liz0001
26 New Member
Thanks all for your ideas. Unfortunately it looks like I'm going to have to give up on this one.

I implemented a work-around.
Jul 19 '08 #10
jhardman
3,406 Recognized Expert Specialist
Glad you got a work-around, even if it wasn't what you originally wanted. Another expert suggested this:
Expand|Select|Wrap|Line Numbers
  1.  Function fixIt(text) 
  2. fixIt= Replace(Replace(Replace(text,chr(189),chr(48)&chr(46) & chr(53)),chr(188),chr(48) & chr(46) & chr(50) & chr(53)), chr(190),chr(48) & chr(46) & chr(55) & chr(53))
  3. End Function
  4.  
Let me know if this helps.

Jared
Jul 21 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

26
by: TomB | last post by:
I have a function on an "included" page. For reasons unknown to me I frequently will get an error - to the effect that the function can't be found. If I hit refresh/F5 it loads the page just...
6
by: Dennis | last post by:
In my program I have defined a global vector with //=======prototypes section ==================== float select(const int k, std::vector<float> &myArr, int iStart, int iEnd); ..... //====Global...
11
by: j23 | last post by:
I have library (static) testlib.cpp: #include <stdarg.h> void xxx(...) { char buf; va_list args; va_start(args, buf); va_end(args); }
2
by: Fernando Barsoba | last post by:
Dear all, I have been posting about a problem trying to encrypt certain data using HMAC-SHA1 functions. I posted that my problem was solved, but unfortunately, I was being overly optimistic. I...
8
by: coosa | last post by:
Dear all, I have the following code: #include <iostream> #include <string> #include <sstream> using namespace std;
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
73
by: Steph Barklay | last post by:
Hi, I'm currently taking a data structures course in C, and my teacher said that function prototypes are not allowed in any of our code. He also said that no professional programmers use function...
15
by: Mikhail Kovalev | last post by:
Hi all, I have a file which is to be included in another script and which takes several seconds to load(!), and which is actually not always used by the script, so instead of using include or...
16
by: lovecreatesbea... | last post by:
It takes mu so time to finish this C source code line count function. What do you think about it? / ******************************************************************************* * Function ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.