# This file is part of the Coral project.
# Please read the copyright notice in the LICENSE file.

import re

def QFileDialogToFilename(qts):
    return unicode(qts).encode("ISO-8859-15")

def QStringToFileName(qts):
    return str(qts.utf8())

def PyStringToFileName(s):
    if (isinstance(s, unicode)):
        return s.encode("UTF-8")
    return unicode(str(s), "ISO-8859-15").encode("UTF-8")

def PyStringToUTF8(s):
    return PyStringToFileName(s)

def FixAmpersandNoAccelerator(s):
    str = re.sub("&", "&&", unicode(s))
    return unicode(str)

