Next / Previous / Contents / Shipman's homepage

18. Sox._strProcessor()

This function implements the interface described in Section 8.1, “content-processor for the str type. The value is coerced to Unicode (if possible) and appended to the contentList.

sox.py
# - - -   S o x . _ s t r P r o c e s s o r

    def _strProcessor(self, item, contentList, attribs):
        '''Process str arguments

          [ type(item) is str ->
              if item is unicode-okay ->
                contentList  +:=  item as unicode
              else -> raise SoxError ]
        '''

For the logic that coerces the value to Unicode, see Section 14, “Sox._unicodify(): Force to Unicode”.

sox.py
        #-- 1
        # [ if item is unicode-okay ->
        #     contentList  +:=  item as unicode
        #   else -> raise SoxError ]
        contentList.append(self._unicodify(item))