Prevent incorrectly capitalized CSS selectors from being stripped

Some wysiwyg editors seem to generate terrible CSS such as:
P {
    PADDING: 0PX;
    MARGIN: 0PX;
}
which due to the capitalized P was not being applied inline.
Currently, there will also be a space after the last rule. What about dropping it by ether trimming $style before returning it, or by putting the rules in an array an exploding it using a space as glue?