"CN" <cnliou9@xxxxxxxxxxx> writes: >> Seems to me that you need to fix your broken middleware --- it has no >> business doing that. > Are you suggesting that the middleware should not escape backslashes in > the first place? No, I'm suggesting that it shouldn't be let loose on Big5 data when it evidently hasn't a clue about that encoding. The byte in question *is not* a backslash, it's not even an independent character; and so changing it on the assumption that it is logically a backslash simply breaks the data. Your quickest route to a solution may be to avoid Big5 in favor of an encoding that is ASCII-safe, such as UTF8. You can feed that through code that only understands ASCII with much less risk than an encoding where second and later bytes might look like ASCII. regards, tom lane