def toLatin1String(text):
  """Convert string to latin1 encoding.
  """
  vtkStr = ""
  for c in text:
    try:
      cc = c.encode("latin1", "ignore").decode()
    except (UnicodeDecodeError):
      cc = "?"
    vtkStr = vtkStr + cc
  return vtkStr