Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(16)  |  Call(14)  |  Derive(0)  |  Import(2)

        def fixEncoding(theString, language=None):
  encoding = ord(theString[0])
  if 0 <= encoding < len(_encodings):
    # If we're dealing with a particular language, we might want to try another code page.
    if encoding == 0 and language == 'ko':
      value = theString[1:].decode('cp949').encode('utf-8')
    else:
      value = theString[1:].decode(_encodings[encoding]).encode("utf-8")
  else:
    value = theString

  if value:
    value = value.strip('\0')

  return value
        


src/s/c/Scanners.bundle-HEAD/Contents/Resources/Common/ID3v2.py   Scanners.bundle(Download)
import string
import struct
from UnicodeHelper import fixEncoding
 
_encodings = ['iso8859-1', 'utf-16', 'utf-16be', 'utf-8']
	def processTALB( self, theString, theFlags, theValue ):
		self.album = fixEncoding( theValue, self.language )
	def processTAL(self, theString, theFlags, theValue):
		self.processTALB(theString, theFlags, theValue)
 
	def processTPE1( self, theString, theFlags, theValue ):
		self.artist = fixEncoding( theValue, self.language )
	def processTP1(self, s, f, v):
		self.processTPE1(s,f,v)
 
  #
  # Sets the TPE2
  #
	def processTPE2( self, theString, theFlags, theValue ):
		self.TPE2 = fixEncoding( theValue, self.language )
	def processTPOS( self, theString, theFlags, theValue ):
		TPOS = fixEncoding( theValue, self.language )
		try:
			if TPOS == '1/1':
				return

src/l/o/LocalMedia.bundle-HEAD/Contents/Libraries/Shared/ID3v2.py   LocalMedia.bundle(Download)
import string
import struct
from UnicodeHelper import fixEncoding
 
_encodings = ['iso8859-1', 'utf-16', 'utf-16be', 'utf-8']
	def processTALB( self, theString, theFlags, theValue ):
		self.album = fixEncoding( theValue, self.language )
	def processTAL(self, theString, theFlags, theValue):
		self.processTALB(theString, theFlags, theValue)
 
	def processTPE1( self, theString, theFlags, theValue ):
		self.artist = fixEncoding( theValue, self.language )
	def processTP1(self, s, f, v):
		self.processTPE1(s,f,v)
 
  #
  # Sets the TPE2
  #
	def processTPE2( self, theString, theFlags, theValue ):
		self.TPE2 = fixEncoding( theValue, self.language )
	def processTPOS( self, theString, theFlags, theValue ):
		TPOS = fixEncoding( theValue, self.language )
		try:
			if TPOS == '1/1':
				return