if the quality scores contain character 0 it is either Sanger phred+33 or Illumina 1.8+ phred+33. When they also contain the character J, it is Illumina 1.8+ phred 33, otherwise it is Sanger phred + 33.
When the quality scores do not contain 0, it is either Solexa +64, Illumina 1.3+ Phred+64, Illumina 1.5+ Phred+64.
Then it is Solexa +64 when it contains character =
It is Illumina 1.3 phred + 64 when it contains A
It is Illumina 1.5 phred +64 when it contains no A or =
Take a look at the wiki and try to understand the table