Changing Windows Unicode Combinations Using Python

Following this question , I decided to use the following Python code to change Windows shortcuts.
It works for shortcuts in English, but it is not for Unicode.

How can I change this (or any other) fragment to Unicode support ?

import re, os, pythoncom from win32com.shell import shell, shellcon shortcut_path = os.path.join(path_to_shortcut, shortcut_filename) shortcut = pythoncom.CoCreateInstance (shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) persist_file = shortcut.QueryInterface (pythoncom.IID_IPersistFile) persist_file.Load (shortcut_path) destination1 = shortcut.GetPath(0)[0] destination2 = os.path.join(destination_path, destination_filename) shortcut.SetPath(destination2) persist_file.Save(shortcut_path, 0) 

Suppose unicode: path_to_shortcut , shortcut_filename , destination_path , destination_filename

+1
python windows unicode shortcuts
source share
1 answer

Perhaps a search here might help: Python Unicode HOWTO

I assume that you need to be sure that each of these lines was correctly encoded as Unicode, and any changes should have kept this encoding. This article should provide all the necessary information.

0
source share

All Articles