This article from Stratfor really identifies the potential pitfalls of dealing with the legal system in China:

A foreign manager at an Apple store in Beijing was arrested in early May after scuffling with a Chinese customer who allegedly was attempting to cut in line during the launch of the white iPhone 4. The foreigner, whose nationality was not revealed but was rumored to be American, was released and not charged after negotiating directly with the customer at the Sanlitun police station and agreeing to pay a 20,000-yuan ($3,000) fine to the customer.

The details of the incident are unclear, but the assumed guilt of the foreigner by authorities and the manner in which the matter was resolved may be surprising to many Westerners. Foreigners are often ignorant of the Chinese legal system, and STRATFOR thought it would be useful to discuss not only the system, but also what foreigners can expect if they find themselves in trouble with authorities while in China.
The Chinese and Western legal systems differ substantially in origin, application and process. Whereas laws exist to protect individuals from the state in the West, in China they protect society from individuals, which to Westerners means they appear to be an instrument of state control.

U.S. federal law is based on a common law legal system, which means it is developed by court decisions rather than legislative statutes or executive action. In a civil law system, which is widely used throughout Latin America, Europe, Africa and Asia, laws are written down and codified, not interpreted by judges. The Chinese legal code is similar to civil law but with its own uniquely Chinese characteristics. It is heavily influenced by Confucian philosophy and legalism, where Confucius believed that men are inherently good and that with social pressure they will do the right thing and legalists believed laws should be strict and punishments harsh.

But unlike in the West, where laws are generally widely known and understood, Chinese law is highly ambiguous, contradictory and difficult to understand, even for Chinese. Nothing is consistent — not the law, its enforcement or its application. Some contend this is due to the piecemeal manner in which Chinese law was created, but many believe that the confusion is intentional. If the law is inscrutable, the authorities have the upper hand and it is difficult for citizens to challenge the state legally. It also is worth noting that precedent is not applicable in the Chinese legal system, allowing authorities tremendous freedom in their rulings. Simply put, no law is above the decisions of the Communist Party.

In Chinese culture, guests are encouraged to enjoy themselves and certain allowances are made. It is when foreigners forget that they are still breaking the law and take the culture for granted that problems arise. Laws are often selectively applied depending on the interests of the authorities at any given time, and it is not uncommon for Western business executives to be compromised by authorities. One thing that will pose problems for foreigners without exception is any act that harms Chinese security or people.

In the event that a foreigner winds up in trouble with the law, it is important that he or she understand the Chinese legal process. Upon arrest, foreigners should not expect to encounter anyone with proficiency in their own language. A translator will arrive as the process moves along — though proficiency is not certain — but it is important for the foreigner not to sign any documents he or she cannot read. Foreigners can seek help from their local embassy or consulate, but the most those offices can do is protect the foreigner’s basic rights (including access to medication, food, water and shelter) and ensure that a lawyer is provided if requested by the foreigner.

The downfall of most detained foreigners in China is in their insistence on ideas of justice and fairness. Westerners often fail to understand the Chinese emphasis on negotiation and social harmony, instead believing they have been wronged and deserve a fair trial. In reality, once a case reaches trial the outcome is all but decided, and most trials result in conviction; even without a conviction, the foreigner can still be deported. Because of corruption and the Chinese principle of guanxi, a foreigner is unlikely to win if he or she is up against a powerful Chinese person in court. For this reason it is important for the foreigner to take advantage of the mediation phase that precedes the trial.
When a foreigner is arrested, the local Foreign Affairs Office, which is responsible for providing a translator, will be contacted. In cases of conflict between two parties, so long as the case is not serious and no one was “severely” harmed, authorities typically will ask if the dispute can be resolved at the level of the local public security bureau (PSB). This process is known in Chinese as tiaojie. It appears that the foreign Apple employee mentioned above resolved his case in this mediation phase at the local office. Foreigners can be put off by this notion because they believe they are being asked to pay a bribe, and it is difficult for foreigners to distinguish corruption, which certainly exists, from the mediation phase. They must recognize that mediation is a requirement of the legal system and a means of settling disputes separately from the court.

If a resolution cannot be reached, the case will be filed with the procuratorate, at which point the process becomes much more bureaucratized, time-consuming and difficult for the foreigner to influence. It also means the case becomes official record, which could mean deportation and/or refusal of a visa for the foreigner in the future. Prior to the trial, the PSB typically will release the person on bail or under residential surveillance, depending on the severity of the crime, because the detention of a foreigner entails strict processes and paperwork and complicates the process for all involved. There are two forms of bail: The first is called bao zheng ren and requires a person to guarantee that you will not flee, and the second is bao zheng jin, which is a more typical form of bail and requires that a sum of money be paid. (Even when released, the foreigner still will be called at various times to come to the local prison to meet with authorities and give statements regarding the case.)

Foreigners also may encounter problems with lawyers. As is the case throughout the world, competency is not assured, nor is proficiency in the foreigner’s native language. Additionally, Chinese lawyers ultimately work for the state and thus can be expected to pursue the state’s interests.

In essence, visitors to China should understand that if they find themselves in legal trouble for whatever reason, the process will not work the same way that it does in the West. The person’s nationality and the severity of the crime will greatly affect how he or she is treated. These are exceptional circumstances, but foreigners in China should be prepared for the arbitrary and selective application of the law and should not expect a Western-style trial if their case reaches that point.
Of note, a similar, but far more just system exists in Thailand. There is a "negotiation" phase that the police facilitate, to help avoid clogging the court system. The court system in Thailand is primarily based upon the British legal system, so it is far more "fair" to deal with it.