Convert string Lenght to 3 Hex Values

2004-05-20 Thread Juan Carlos Cruz Dada
Greetings perlers,

new PSQ for you, so please bear with me. I'd like to convert the lenght of a
string into 3 Hex Values, eg.
if length($str) == 5 it would print 00 00 05

the only way I think of doing this is modding or dividing by 255 to get the
values... any ideas?

thanks in advanced,

regards,

-
Juan Carlos Cruz Dada
Production Manager
Senior Developer
Cital Web Solutions
[EMAIL PROTECTED]
Tel. 247-7900 Ext. 213

The information contained in this message is privileged and confidential.
It is intended solely for the use of the named recipient. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the contents of this transmission is strictly
prohibited.
If you receive this message in error, please notify the sender immediately.
Thank you.


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Convert string Lenght to 3 Hex Values

2004-05-20 Thread Juan Carlos Cruz Dada
Thanks Rob,

I think this will do it.

David,

I can't give you a real example as I'm in the process of developing a new
protocol, keeping with the post yo answered me on 10/03/2004. I do want the
lenght, not the string. when I have the working protocol, I'll be glad to
share it with you guys.

regards,

-
Juan Carlos Cruz Dada
Production Manager
Senior Developer
Cital Web Solutions
[EMAIL PROTECTED]
Tel. 247-7900 Ext. 213

The information contained in this message is privileged and confidential.
It is intended solely for the use of the named recipient. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the contents of this transmission is strictly
prohibited.
If you receive this message in error, please notify the sender immediately.
Thank you.
- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]
To: Juan Carlos Cruz Dada [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Thursday, May 20, 2004 10:31 AM
Subject: Re: Convert string Lenght to 3 Hex Values


Juan Carlos Cruz Dada wrote:

 new PSQ for you, so please bear with me. I'd like to convert the lenght of
a
 string into 3 Hex Values, eg.
 if length($str) == 5 it would print 00 00 05

 the only way I think of doing this is modding or dividing by 255 to get
the
 values... any ideas?

Hi.

I'm not exactly clear what you mean. If the length of the string was 512
would
you want '00 02 00' printing? How about this:

  my $str = 'abcde';
  my $hexlen = join ' ', sprintf('%06X', length $str) =~ /../g;

  print $hexlen, \n;

**OUTPUT

  00 00 05

HTH,

Rob




___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Send Hex values and ASCII Values over a TCP Socket

2004-03-12 Thread Juan Carlos Cruz Dada
Hello perlers,

I'm trying to send tome information over a TCP Socket, but I have to send
the length of the package as Hex, and the rest as ASCII. Could someone
explain me how to do that please? I've converted the length to Hex but it
always sends everything as ASCII. Here's the code. it's a very simple
program.

- code 
use IO::Socket::INET;
$remote_host = '127.0.0.1';
$remote_port = 3050;
$socket = IO::Socket::INET-new(PeerAddr = $remote_host,
PeerPort = $remote_port,
Proto= tcp,
Type = SOCK_STREAM)
or die Couldn't connect to $remote_host:$remote_port : $!\n;
$trama = text information;
print $socket length($trama); # This is what I need to send in Hex.
print $socket $trama;
$answer = $socket;
close($socket);
print $answer;
--- end of code ---

thanks in advanced.

-
Juan Carlos Cruz Dada
Production Manager
Senior Developer
Cital Web Solutions
[EMAIL PROTECTED]
Tel. 247-7900 Ext. 213

The information contained in this message is privileged and confidential.
It is intended solely for the use of the named recipient. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the contents of this transmission is strictly
prohibited.
If you receive this message in error, please notify the sender immediately.
Thank you.


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Double Byte Characters.

2003-11-17 Thread Juan Carlos Cruz Dada
Greeting Perlers,

I have a mixed problem with Perl and HTML. I'm developing a web form to send
contact emails, that uses two byte characters (kanji, chinese characters,
etc). If I use the perl script with input from the console, it send the
email correctly, but when I use the script in the web environment, the
browser translates the kanji to HTML Codes. So the main question would be...
can you translate the HTML Codes to double byte characters in Perl prior to
encode the message to send? this problem is mainly with the subject, as the
content can be html encoded...

thanks in advanced...
-
Juan Carlos Cruz Dada
Senior Developer
Cital Web Solutions
[EMAIL PROTECTED]
Tel. 247-7900 Ext. 213


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Generating email in different languages (Net::SMTP and Simplified Chinese)?

2003-10-23 Thread Juan Carlos Cruz Dada
Howard,

You can use the Net::SMTP to send multybyte characters. What you need to do
is (i guess is stated in the RFC1521) encode base64 the string prior to send
the data (if is the subject).  You can have plenty of examples (most on PHP)
doing a simple
google search.

For message, just encode it in HTML and the email client will convert it for
you.

I'll try to get a working example to show.

regards

JC


-Original Message-
From: Bullock, Howard A. [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 23, 2003 6:16 AM
To: '[EMAIL PROTECTED]'
Subject: Generating email in different languages (Net::SMTP and
Simplified Chinese)?


I have been struggling with this for weeks and am no closer to a solution.
Any insights would be appreciated. I was trying to use a Unicode text file
written in Simplified Chinese using Notepapd.exe as part of the content of
an email generated via Net::SMTP.

1) Will Net::SMTP be able to accomplish this task?
2) Should I be using a different mail module? If so, which one?
3) What do I need to be aware of when processing Unicode characters?
4) Does anyone have an example that would be useful in this situation?


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RTF::TEXT::Converter

2003-08-27 Thread Juan Carlos Cruz Dada
Greetings perlers,

I'm using RTF::TEXT:Converter in a migration of data from RTF to Plain Text.
The problem is that I cannot redirect the parsing to a file or a variable,
even though I have changed the Output setting. Here's part of the code, I
need to redirect from STDOUT to a variable preferably. Any help is highly
appreciated.

require RTF::TEXT::Converter;
my $self = new RTF::TEXT::Converter(Output = \*STDOUT);
$self-parse_string($tempo);

Regards,
-
Juan Carlos Cruz Dada
Senior Developer
Cital Web Solutions


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs