- Code: Select all
variable = indigo.variables[356743265].value
if variable == "Mähen":
...
However, even though it contains "Mähen" it just doesn't work. I think it has to do with encoding...
What can I do?
variable = indigo.variables[356743265].value
if variable == "Mähen":
...
variable = indigo.variables[356743265].value
if variable == u"Mähen":
indigo.server.log('TRUE')
else:
indigo.server.log('FALSE')
variableValue = indigo.variables[356743265].value
if variableValue == u"Mähen":
indigo.server.log('TRUE')
else:
indigo.server.log('FALSE')
variableValue = indigo.variables[32452423].value
if variableValue == "test" or variableValue == u"Mähen":
indigo.server.log(variableValue)
davinci wrote:I get the string from html but even when I type manually it ist not working.
The editor is Xcode.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#######################
import unicodedata
variableValue = indigo.variables[356743265].value
compareValue = u"Mähen"
compareCharacter = u'ä'
indigo.server.log('variableValue: %s, Type=%s, Length=%s' % (variableValue, type(variableValue), len(variableValue)))
indigo.server.log('compareValue: %s, Type=%s, Length=%s' % (compareValue, type(compareValue), len(compareValue)))
if len(compareCharacter) == 1:
indigo.server.log('unicodedata for character \'ä\': %s' % (unicodedata.category(compareCharacter)))
elif len(compareCharacter) == 2:
indigo.server.log('unicodedata for character \'ä\': %s, %s' % (unicodedata.category(compareCharacter[0]), unicodedata.category(compareCharacter[1])))
if variableValue == compareValue:
indigo.server.log('TRUE = %s' % variableValue)
else:
indigo.server.log('FALSE = %s' % variableValue)
Script variableValue: Mähen, Type=<type 'unicode'>, Length=5
Script compareValue: Mähen, Type=<type 'unicode'>, Length=5
Script unicodedata for character 'ä': Ll
Script TRUE = Mähen
Script variableValue: Mähen, Type=<type 'unicode'>, Length=5
Script compareValue: Mähen, Type=<type 'unicode'>, Length=6
Script unicodedata for character 'ä': Lu, Sc
Script FALSE = Mähen
Users browsing this forum: No registered users and 4 guests