UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined> (problem with unicode symbol Unicode Character 'HEAVY CHECK MARK' (U+2714))

335 views
Skip to first unread message

Román Ramos Cabrera

unread,
Dec 23, 2019, 1:14:06 PM12/23/19
to GAM for G Suite
Good morning everyone

There is an important error that is preventing me from correctly reading the tags of an account in java, the error is as follows:

C:\Users\user>gam user ma...@mail.com show labels > test
Traceback (most recent call last):
  File "C:\Users\travis\build\jay0lee\GAM\src\gam.py", line 14989, in <module>
  File "C:\Users\travis\build\jay0lee\GAM\src\gam.py", line 14676, in ProcessGAMCommand
  File "C:\Users\travis\build\jay0lee\GAM\src\gam.py", line 6395, in showLabels
  File "C:\Python38\lib\encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>
[3128] Failed to execute script gam

if we do it without the "> test" 

It shows all the tags but there are 2 that does not translate the unicode symbol, in this case it is ✔ and ✔✔

when you execute the command it looks like this


cmd.png

The problem is with these 2 tags in Gmail that I don't know if they are Gmail defaults or it's from the Mailtrack

2019-12-23_11-38-38.png


if we inspect the element in the gmail page we can see how it is not written in unicode in the html or so it seems

chrome_2019-12-23_17-58-48.png


If we follow the error messages that appear when trying to dump the output of a file, we see that the problem is in the utils.py file in the convertUTF method because it really does nothing, it only returns the value as it is sent, so which we are not converting the symbol to "String", and tried to change this file and perform the installation but in windows it is only possible with the msi and in linux it looks for the installer on the internet so it becomes quite complex to be able to test changes

14989.png

14676.png

6395.png

utils.png



Fixing this error will surely solve many others


Cheers



Jay Lee

unread,
Dec 23, 2019, 2:56:23 PM12/23/19
to google-ap...@googlegroups.com
Can you try rewriting the last few lines of gam.py to look like this and see if that solves for you? It assumes you have Python 3.7 or newer. Bolded lines are what you need to add

  if sys.version_info[0] < 3 or sys.version_info[1] < 5:
    controlflow.system_error_exit(5, 'GAM requires Python 3.5 or newer. You are running %s.%s.%s. Please upgrade your Python version or use one of the binary GAM downloads.' % sys.version_info[:3])
  elif sys.version_info[1] >= 7:
    sys.stdout.reconfigure(encoding=UTF8, errors='namereplace')
 
sys.exit(ProcessGAMCommand(sys.argv))

Este mensaje es solamente para la persona a la que va dirigido. Puede contener información confidencial o legalmente protegida. No hay renuncia a la confidencialidad o privilegio por cualquier transmisión mala o errónea. Si usted ha recibido este mensaje por error, le rogamos que borre de su sistema inmediatamente el mensaje asi como todas sus copias, destruya todas las copias del mismo de su disco duro y notifique al remitente. No debe, directa o indirectamente, usar, revelar, distribuir, imprimir o copiar ninguna de las partes de este mensaje si no es usted el destinatario. Cualquier opinión expresada en este mensaje proviene del remitente, excepto cuando el mensaje establezca lo contrario y el remitente est autorizado para establecer que dichas opiniones provienen de empresas del Grupo Satocan. Nótese que el correo electrónico via Internet no permite asegurar ni la confidencialidad de los mensajes que se transmiten ni la correcta recepción de los mismos. En el caso de que el destinatario de este mensaje no consintiera la utilización del correo electrónico via Internet, rogamos lo ponga en nuestro conocimiento de manera inmediata.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/0f5561a1-1c01-476b-8861-24ee18481e8b%40googlegroups.com.

Román Ramos Cabrera

unread,
Dec 26, 2019, 2:53:28 AM12/26/19
to GAM for G Suite
Thanks for your answer,

That is another of my doubts that I put when I open the thread, in Windows you have an .msi in which you can not modify the program files and when you install it you have an .exe and some files that are not program code

In Linux something similar happens that you download the code and you can modify it but when you run the gam-install.sh this what it does is download the code from the internet and therefore does not apply what changes you make in the code that you download and modify and then when wanting to search for the gam program file in linux I only get the gam / bin executable but there are no more files

If you could tell me how to make changes in the operation of the program, I would appreciate it because I am still lost in this topic, once you try the code you are commenting I will tell you if it works

by the way I have python 3.8.0
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Román Ramos Cabrera

unread,
Dec 26, 2019, 3:06:00 AM12/26/19
to GAM for G Suite
Seeing the code you show is not exactly the same as in GAM version 4.96

This is the code ...

  if sys.version_info[0] < 3 or sys.version_info[1] < 5:
    systemErrorExit(5, 'GAM requires Python 3.5 or newer. You are running %s.%s.%s. Please upgrade your Python version or use one of the binary GAM downloads.' % sys.version_info[:3])
  sys.exit(ProcessGAMCommand(sys.argv))

 I still have a doubt, the elseif would only be applied when you dump a file or read from java, right? because executing the normal command doesn't really give error

El lunes, 23 de diciembre de 2019, 19:56:23 (UTC), Jay Lee escribió:
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages