(self, source, dest, convert_to_binary)
Copies a .strings file using iconv to reconvert the input into UTF-16.
Copies a .strings file using iconv to reconvert the input into UTF-16.
Copies a . strings file using iconv to reconvert the input into UTF - 16 .
def _CopyStringsFile(self, source, dest, convert_to_binary):
    """Copies a .strings file using iconv to reconvert the input into UTF-16."""
    input_code = self._DetectInputEncoding(source) or "UTF-8"

    # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call
    # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints
    #     CFPropertyListCreateFromXMLData(): Old-style plist parser: missing
    #     semicolon in dictionary.
    # on invalid files. Do the same kind of validation.
    import CoreFoundation
    s = open(source, 'rb').read()
    d = CoreFoundation.CFDataCreate(None, s, len(s))
    _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None)
    if error:
      return

    fp = open(dest, 'wb')
    fp.write(s.decode(input_code).encode('UTF-16'))
    fp.close()

    if convert_to_binary == 'True':
      self._ConvertToBinary(dest)
def _CopyStringsFile ( self , source , dest , convert_to_binary ) : input_code = self . _DetectInputEncoding ( source ) or "UTF-8" # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints #     CFPropertyListCreateFromXMLData(): Old-style plist parser: missing #     semicolon in dictionary. # on invalid files. Do the same kind of validation. import CoreFoundation s = open ( source , 'rb' ) . read ( ) d = CoreFoundation . CFDataCreate ( None , s , len ( s ) ) _ , error = CoreFoundation . CFPropertyListCreateFromXMLData ( None , d , 0 , None ) if error : return fp = open ( dest , 'wb' ) fp . write ( s . decode ( input_code ) . encode ( 'UTF-16' ) ) fp . close ( ) if convert_to_binary == 'True' : self . _ConvertToBinary ( dest )