Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > problems with caret

problems with caret
Thread Tools
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Zurich, Switzerland
Status: Offline
Reply With Quote
Jun 19, 2001, 09:19 AM
 
I'm having problems with the caret character (^). I'm running a program called sarad (a server application for accessing the British National Corpus) and am communicating with this via a perl filehandle/tcp socket:

$fh=&createSaradSock();

sub createSaradSock {

#Socket stuff
$iaddr = inet_aton($remote);
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname('tcp');
socket(S, PF_INET, SOCK_STREAM, $proto) || bark("$!");
connect(S, $paddr) || bark("$!");

#sara needs NULL terminated strings
$null= "\000";

#unbuffer the socket & define NULL as linefeed
$currentHandle = select(S);
$|=1;
$/=$null;
select($currentHandle);

# ask for code page 850 (sets charset to WINDOWS ANSI)
$query="INFO 850$null";
print S $query;
$response = <S>;
$response=~m/OK/ or bark("$response");


# logging into sarad server
$query="LOG $username $password$null";
print S $query;
$response = <S>;
$response=~m/OK/ or bark("$response");

return \*S;
}

The problem occurs when I want to send the following command to the server:

SOLVE hq000001 ^"strike=VERB"

here's the corresponding code out of the script:

$query='SOLVE ' . $qName . ' ^"strike=VERB"' . $null;
print $fh $query;
$response = <$fh> or saySorry2();

But this doesn't work. It just doesn't return anything and saySorry2() is executed. When I run SOLVE from the shell, I get the message "broken pipe". The syntax for this query is OK and the script runs just fine as long as I don't have a caret in the query string.
In addition, if I connect via tcp socket to a remote sarad runnning on a linux machine, the code executes fine as well, including the queries with a caret.

So the question is: Is this likely to be a problem of the sarad server as compiled under OS X (I would then try to get in touch with the programmer) or do you see any other possible ways how the caret could get mixed up?
Many thanks in advance for any suggestions.
Sebastian
     
Senior User
Join Date: Mar 2000
Location: Ithaca, NY
Status: Offline
Reply With Quote
Jun 20, 2001, 02:18 PM
 
Well, I'm no expert in this area, but I did have one idea which is somewhere along the line, something might be trying to interpret that caret as a control character escape sequence, so you might try using two carets instead. Dunno if it'll work, but it might be worth a shot.
     
sebhoff  (op)
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Zurich, Switzerland
Status: Offline
Reply With Quote
Jun 21, 2001, 03:23 AM
 
Originally posted by bewebste:
<STRONG>Well, I'm no expert in this area, but I did have one idea which is somewhere along the line, something might be trying to interpret that caret as a control character escape sequence, so you might try using two carets instead. Dunno if it'll work, but it might be worth a shot.</STRONG>
Thanks for the suggestion, but it didn't work ;-(
Sebastian
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -5. The time now is 12:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2