losting some characters
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

losting some characters

Started by xjr13sp, 23 October, 2003, 20:02:11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xjr13sp

Hi,

I have troubles with a script.
In this part of code I get a string value, but you know: I'm French and so, I will have many characters with accents and ponctuations.

CODE:

function Get2Args(data)
   s,e,whoTo,from,cmd,arg,arg2= strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+([%w%s]+)")
   return arg,arg2
end

if (cmd=="!memo") then
   arg,arg2 = Get2Args(data)
   ........ actions
end if


The problem is befoer the line s,e,whoTo,from,cmd,arg,arg2=str...., my string value keeps all of the accents and ponctuations, but after passed this line, the string value is troncated at the first met accent!!

For example:
if I send the string "le niveau sup?rieur de grade", I will have "le niveau sup"
if I send the string "Quelqu'un m'a appel? ?", I will have "Quelqu "

Is someone knows why I have this problem? I use Ptokax...

raz

i don't have the sligest clue maybe if u post all of the script it will help more.

Skrollster

No the problem lies in here:

function Get2Args(data) 
	s,e,whoTo,from,cmd,arg,arg2= strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+([%w%s]+)") 
	return arg,arg2 
end

the sign " ' " isn't included in this: [%w%s]

use this code and it should work:

function Get2Args(data) 
	s,e,whoTo,from,cmd,arg,arg2= strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+(.+)") 
	return arg,arg2 
end

Skrollster

and this will also work:_

function Get2Args(data) 
	s,e,arg,arg2= strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)") 
	return arg,arg2 
end

OpiumVolage

Try to change you regex to:
s,e,arg,arg2= strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(%S+)%s+(.+)")

or

s,e,arg,arg2= strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(%S+)%s+(.+)|")

I think that this form was for excluding the "|" at the end.

Skrollster

opium your a bit slow :P

OpiumVolage

33.6k with dl running :)

But you are too fast :)

s,e,arg,arg2= strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.+)")

There where 3 captures :)

Skrollster

feel sorry for you..

<== has 10bit download bandwith..

xjr13sp

Thank you SO MUCH Skrollster!!!!
Your first idea was the good one. It works well.

Thank you too OpiumVolage for your help. I didn't test your solution, but I take note of this eventuality.....

Thousands thx  :))

OpiumVolage

DOn't feel sory, this mean i'm at home, ... and in vacations.

Skrollster

Opium: Ok, good for you :P

xjr13sp: if you just are looking for the arguments then the second post should work just as well but will use less resorces..

SMF spam blocked by CleanTalk