Accented characters

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Cadou
Messages: 5
Registration: Apr 03, 2015 - 3:04 p.m.

April 7, 2015 - 11:54

Good morning,

I am currently creating a WAPT package to use a WSUS server in an environment without AD.
I'm not proficient in Python, and despite my research, I can't seem to preserve the character "é" in a string. I've tried several solutions, such as using "u" before it, without success.

Here is the relevant code snippet (the character is located in "unassigned computer"):

Code: Select all

#ouverture de la clef  keygroupe=reg_openkey_noredir(HKEY_CURRENT_USER,'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\WindowsUpdate\\AU',sam=KEY_WRITE,create_if_missing=True)

#determine le groupe d'attribution de l'ordinateur
keyname=reg_openkey_noredir(HKEY_LOCAL_MACHINE,'SYSTEM\\ControlSet001\\Control\\ComputerName\\ComputerName',sam = KEY_READ)

localhost = reg_getvalue(keyname,'ComputerName')

    if type(localhost[1:4]) == int:
        groupe = 'Pedagogique'
    else:
	groupe = 'Ordinateur non attribué' 

#indique le groupe d'attribution au serveur WSUS
reg_setvalue(keygroupe,'TargetGroupEnabled',1,REG_DWORD)
reg_setvalue(keygroupe,'TargetGroup',groupe,REG_SZ)
print('Ordinateur attribue au groupe ' + '"' + groupe + '"')
This "Unassigned Computer" group is a default group that I cannot delete or modify; I would prefer to use it.
Do you have a solution to properly account for this characteristic?

Thank you so much.

Antoine Cadou
User avatar
Yvan Karmouta
Messages: 34
Registration: June 18, 2014 - 10:09
Contact :

April 8, 2015 - 2:37 PM

Hello,
did you specify the encoding at the beginning of the setup.py file:
# -*- coding: utf-8 -*-
Yvan Karmouta - Tranquil IT Systems
Feel free to leave us your opinion on Wapt in the forum, or to answer our questionnaires :).
Cadou
Messages: 5
Registration: Apr 03, 2015 - 3:04 p.m.

April 8, 2015 - 4:29 PM

Thank you for your reply.

The setup.py file does indeed begin with the line:
# -*- coding: utf-8 -*-

Please let me know if anything else can be checked.
User avatar
Yvan Karmouta
Messages: 34
Registration: June 18, 2014 - 10:09
Contact :

April 9, 2015 - 9:31 AM

Okay, one second simple thing, but in the code you copied, the indentation for the line in question is missing. Did you add it to your file?
Yvan Karmouta - Tranquil IT Systems
Feel free to leave us your opinion on Wapt in the forum, or to answer our questionnaires :).
Cadou
Messages: 5
Registration: Apr 03, 2015 - 3:04 p.m.

April 9, 2015 - 1:53 PM

Indeed, the indentation was not respected in my post.
But it seems suitable in my file.
Here is the beginning of the code:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

# registry key(s) where WAPT will find how to remove the application(s)
uninstallkey = []

# command(s) to launch to remove the application(s)
uninstallstring = []

# list of required parameters names (string) which can be used during install
required_params = []


def install():
    # if you want to modify the keys depending on environment (win32/win64... params..)
    global uninstallkey
    global uninstallstring

    print('installing tis-clientwsus')
I found a way to work around the problem by using 'unassigned computers' instead of 'unassigned computers'.
However, I remain interested if you have an answer.
User avatar
ssamson
Messages: 245
Registration: June 20, 2014 - 10:29

April 14, 2015 - 10:55

Hello,

are you sure you have these properties in your file?
Attachments
utf8.jpg
utf8.jpg (38.61 KB) Viewed 8980 times
Steven Samson - Tranquil IT Systems
Feel free to leave us your opinion on Wapt in the forum, or to answer our questionnaires :).
Cadou
Messages: 5
Registration: Apr 03, 2015 - 3:04 p.m.

April 14, 2015 - 3:19 PM

Hello,

After checking, the file properties are UTF-8 no BOM.
I tried with UTF-8 (without BOM) and the result is the same:
when I print('Unassigned computers') I get Unassigned computers,s
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

April 21, 2015 - 12:03

The setup.py file must be encoded in UTF-8 without BOM.
You must put # -*- coding: utf-8 -*- at the beginning of the file
and prefix the strings with a 'u' for Unicode.
print(u'Computer assigned to the group')
Tranquil IT
Cadou
Messages: 5
Registration: Apr 03, 2015 - 3:04 p.m.

April 27, 2015 - 1:30 PM

Hello,
thank you for your reply.
Unfortunately, I have the same problem despite using the "u" prefix and the other parameters you gave me.
Locked