تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3070 أدوات العرض

Hi,

I have Odoo installed from github on an Ubuntu 14.04 machine. Odoo starts at boot with a script that I copied from the /debian/init file.

I built a custom module that reads file names from a directory on the server and lists them. I checked all possible unicode naming problems there, I hope.

My problem is that when I first boot the machine, log into Odoo and go to where my module should display file names I get an error "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)"

That character is a non ascii one.

The strange thing is that if I stop odoo and then restart it the problem goes away and file names get read correctly.

Any help?

Thanks,

Frank

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Solved by myself by adding a definition of the LANG variable to the init script:

case "${1}" in
        start)
                echo -n "Starting ${DESC}: "

                LANG="it_IT.UTF-8" start-stop-daemon --start --quiet --pidfile ${PIDFILE} \     ##!! Here I define a utf-8 locale
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

 

الصورة الرمزية
إهمال