# Forum

## Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

# Thread: tokencustomset and whitespace problem

1. -= TeamSpeak Addict =-
Join Date
September 2006
Location
Germany / Hannover
Posts
137

## tokencustomset and whitespace problem

If i add a token with parameter 'customset' i am not able to add a value with whitespaces.
The token creates a normal entry in the table 'tokens' with the whitespace (not escaped) but if one user use this token the value from customset is not tranfered into the table 'custom_fields' (only the chars in front of the whitespace are used).

I think the modul for adding the values from table 'token' into table 'custom_fields' has to excape the whitespaces from the valuefield himself.

Iam not able to use the 'tokenadd' with escaped \s

EDIT: in other words, how do i add whitespaces in value from tokencustomset with the tokenadd command (which are complete shows in the custom_field table)?

2. -= TeamSpeak Team =-
Join Date
September 2012
Posts
6,079
Privilege keys that contain custom information can only be created from the serverquery interface and those cannot contain whitespaces in the first place with the exception to separate parameters.
You have to escape the escape character so that - after an unescape has taken place when the server parses the command - whats left is exactly what you'd want.
Eg:
Code:
tokencustomset=ident=forum_id\svalue=123\pident=forum_name\svalue=This\\sis\\smy\\sForum\\sName\\swith\\sspaces\pident=reg_date\svalue=1349692028

3. -= TeamSpeak Addict =-
Join Date
September 2006
Location
Germany / Hannover
Posts
137
Sorry Chris, did'nt work.

Table tokens contains the value without the escaped whitespace and thereafter the entry in the table custom_fields contains only the chars up to the whitespace. As i said in my previous post, the internal transfer of whitechars are buggy.

here the testcode:
PHP Code:
fwrite(\$fp"tokenadd tokentype=0 tokenid1=\$ts3membergroup tokenid2=0 tokendescription=Usergroup\sRegisterd\sfor\s\$DET_PID-\$nick tokencustomset=ident=vatsimid\svalue=\$DET_PID\pident=name1\svalue=testuser\\sohne\\sbedeutung\r\n");
after that, table tokens, field token_customset contains
Code:
ident=vatsimid value=123456|ident=name1 value=testuser ohne bedeutung
and after used the token the table custom_fields contains

Code:
ident    value
name1    testuser
vatsimid 123456

4. -= TeamSpeak Team =-
Join Date
September 2012
Posts
6,079
I cannot reproduce this:
Code:
tokenadd tokentype=0 tokenid1=12 tokenid2=0 tokendescription=Normal\sGroup\sKey\swith\sextra\sData tokencustomset=ident=foo\svalue=bar\pident=user_id\svalue=123456\pident=name\svalue=This\\stest\\scontains\\swhitespace\\sand\\seven\\sa\\spipe\\s\\p\\ssee...
In the Database:
Code:
mysql> SELECT * FROM tokens WHERE token_created > UNIX_TIMESTAMP(NOW()) - 600;
+-----------+------------------------------------------+------------+-----------+-----------+---------------+----------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
| server_id | token_key                                | token_type | token_id1 | token_id2 | token_created | token_description                | token_customset                                                                                                                  |
+-----------+------------------------------------------+------------+-----------+-----------+---------------+----------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
|         1 | ZURNJNWCxrZdcrDrIp24Y6Vx8KrrA4yW6BHHUJB+ |          0 |        12 |         0 |    1349706056 | Normal Group Key with extra Data | ident=foo value=bar|ident=user_id value=123456|ident=name value=This\stest\scontains\swhitespace\sand\seven\sa\spipe\s\p\ssee... |
+-----------+------------------------------------------+------------+-----------+-----------+---------------+----------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
It might be because you are using PHP to write to the socket, and PHP detects \\ as an escaped \ and might only send one \ to the socket. So you might actually have to replace \\ with \\\\ to get two backslashes on the socket.

5. -= TeamSpeak Addict =-
Join Date
September 2006
Location
Germany / Hannover
Posts
137
Originally Posted by Chris
...
It might be because you are using PHP to write to the socket, and PHP detects \\ as an escaped \ and might only send one \ to the socket. So you might actually have to replace \\ with \\\\ to get two backslashes on the socket.

*gnarf* ... thats it ... now the complete name with whitespace appears in the custom_flieds

strange programming inside the ts3

thx

6. -= TeamSpeak Team =-
Join Date
September 2012
Posts
6,079
Not so much TS3 but PHP knowing escape sequences too
Either way glad you got it working.