Method: 1
When I just used the below,
detail['comments']
Query is read as
insert into ticket_time ( exclusion, time_submitted, seconds_worked,
submitter, worker, modified, comments, ticket_time_status, reason,
time_started, ticket) values ('on-premise', 1583650057, 7200.0,
'sergio.martinez', 'sergio.martinez', 1583650057, u'BRD_PAG_009 Pago
Establecimientos BRD_ACT_015 Maduraci\\xf3n de Operaciones de Cr\\xe9dito',
0, 'mentoring/review', 1583346600, 1693) returning
id,ticket,exclusion,reason,time_started
And I am getting below error in log file
ProgrammingError: type "u" does not exist
LINE 1: ...'sergio.martinez', 'sergio.martinez', 1583649598, u'BRD_PAG_...
the original value of the chunk
detail['comments']
is "BRD_PAG_009 Pago Establecimientos BRD_ACT_015 Maduración de Operaciones
de Crédito".
METHOD:2
this time I used like this,
and the error is same as above.
I am trying a lot and struggling with this! I don't know how to safely
insert it into db.
On Sunday, March 8, 2020 at 1:33:42 AM UTC+5:30, RjOllos wrote:
>
>
>
> On Friday, March 6, 2020 at 6:26:06 AM UTC-8, Velu Narasimman wrote:
>>
>> I am getting some input from user and that input has some non ASCII
>> characters. The user is using some Spanish characters like 'ó', 'é' etc.,
>> when I save his input to database I face UnicodeEncodeError.
>>
>> Traceback (most recent call last):
>> File
>> "/usr/local/lib/python2.7/dist-packages/Trac-1.0.15-py2.7.egg/trac/web/main.py"
>> , line 624, in _dispatch_request
>> dispatcher.dispatch(req)
>> File
>> "/usr/local/lib/python2.7/dist-packages/Trac-1.0.15-py2.7.egg/trac/web/main.py"
>> , line 302, in dispatch
>> resp = chosen_handler.process_request(req)
>> File
>> "/usr/local/lib/python2.7/dist-packages/timesheet-1.0-py2.7.egg/timesheet/form_ui.py"
>> , line 1173, in process_request
>> timeEntry.create_weekly(project_env,timesheet_result,project)
>> File
>> "/usr/local/lib/python2.7/dist-packages/timesheet-1.0-py2.7.egg/timesheet/model.py"
>> , line 289, in create_weekly
>> str(detail['comments']).replace('"', '').replace("'", '').replace(
>> '\n', ' ').replace('\r', ' '),\
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
>> position 37: ordinal not in range(128)
>>
>> If there is any support page for unicode usage in Trac it would be
>> better. Please help me how I can get some randome language characters input
>> like this and store it to db without issues.
>>
>
> Try:
>
> str(detail['comments']) -> detail['comments']
>
> Or
>
> str(detail['comments']) -> unicode(detail['comments'])
>
> - Ryan
>
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/trac-users/d14c0a5a-629d-4b57-adff-1127928ddae4%40googlegroups.com.