def encode_cp1252(content)
array_utf8 = content.unpack('U*')
array_enc = []
array_utf8.each do |num|
case num
when 0..0xFF; array_enc << num
when 0x20AC; array_enc << 0x80
when 0x201A; array_enc << 0x82
when 0x0192; array_enc << 0x83
when 0x201E; array_enc << 0x84
when 0x2026; array_enc << 0x85
when 0x2020; array_enc << 0x86
when 0x2021; array_enc << 0x87
when 0x02C6; array_enc << 0x88
when 0x2030; array_enc << 0x89
when 0x0160; array_enc << 0x8A
when 0x2039; array_enc << 0x8B
when 0x0152; array_enc << 0x8C
when 0x017D; array_enc << 0x8E
when 0x2018; array_enc << 0x91
when 0x2019; array_enc << 0x92
when 0x201C; array_enc << 0x93
when 0x201D; array_enc << 0x94
when 0x2022; array_enc << 0x95
when 0x2013; array_enc << 0x96
when 0x2014; array_enc << 0x97
when 0x02DC; array_enc << 0x98
when 0x2122; array_enc << 0x99
when 0x0161; array_enc << 0x9A
when 0x203A; array_enc << 0x9B
when 0x0152; array_enc << 0x9C
when 0x017E; array_enc << 0x9E
when 0x0178; array_enc << 0x9F
else
if num <= 0xFF
array_enc << num
else
array_enc.concat "&\##{num};".unpack('C*')
end
end
end
array_enc.pack('C*')
end