AT Command return has been corrupted

Hi everyone, I am coding the python script for check balance of the sim on module GSM A6, here is my python code:
port = serial.Serial("/dev/ttyAMA0",baudrate=9600,timeout=1)

port.write('AT+CMGF=0'+'\r\n')
time.sleep(2)
port.write('AT+CSCS="HEX"'+'\r\n')
time.sleep(2)
port.write('AT+CUSD=1,"*101#",15'+'\r\n')
time.sleep(60)
while True:
    if port.inWaiting() > 0:
        reply = port.readline()
        if '+CUSD:' in reply:
            reply = reply[reply.find(',"'):reply.find('",')]
            print reply
    else:
        break
port.flushInput()
port.flushOutput()
port.close()

The response from serial sometime I can get full, some time it was corrupted like this:
+CUSD: 1, "D8B41B344687DF20580C879BC56A��MN�&���
How can I fix that ?

I am wondering why you are setting CMGF=0 ?
If you want ASCII text response you need to set CMGF=1. Am i correct?

I want to get the HEX result :D, anyway after reseting several time this working correctly right now :smiley: thank u so much

Great. Glad it worked :smiley: