Encoding error using get_key_value_string

Please post any questions about developing your plugin here. Please use the search function before posting!
_Ododo_
Junior Member
Posts: 4
Joined: Sat May 30, 2015 1:03 am

Encoding error using get_key_value_string

Postby _Ododo_ » Sat May 30, 2015 1:16 am

Hello, i'm new to SP
I encounter a UTF-8 encoding error when using BaseEntity.get_key_value_string (btw it shouldn't be a method of Edict class as specified in the Wiki ?)

Here is the traceback:

Syntax: Select all

from entities.helpers import create_entity, spawn_entity
from entities.entity import BaseEntity
...

env_mic_i = create_entity('env_microphone')
env_mic = BaseEntity(env_mic_i)
#env_mic.set_key_value_string('Name', 'heythere')
spawn_entity(env_mic_i)
a = env_mic.get_key_value_string('Name')


a = env_mic.get_key_value_string('Name')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdd in position 1: invalid continuation byte

What am i doing wrong ?

ty !
_Ododo_
Junior Member
Posts: 4
Joined: Sat May 30, 2015 1:03 am

Postby _Ododo_ » Sat May 30, 2015 1:23 am

Sorry i found that i needed to use 'Targetname' instead of 'Name', i would be great to handle bad key requests in SP 's code.
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat May 30, 2015 1:27 am

_Ododo_
Junior Member
Posts: 4
Joined: Sat May 30, 2015 1:03 am

Postby _Ododo_ » Sat May 30, 2015 1:31 am

User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat May 30, 2015 1:43 am

_Ododo_
Junior Member
Posts: 4
Joined: Sat May 30, 2015 1:03 am

Postby _Ododo_ » Sat May 30, 2015 1:49 am

User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Thu Jun 11, 2015 5:23 pm

En fait, j'avais parler trop vite. Je viens d'ajouter une exception lorsque le nom n'est pas valide: 5f5503b

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 116 guests