Old-fashioned use of "ihm" with "Mädchen"
I've been looking at a website that shows the original 1857 Brothers Grimm story of Cinderella (Aschenputtel). There are some sentences that are clearly referring to the girl, Ashenputtel, but the pronoun "ihm" is used.
For native German speakers out there, is that just an old-fashioned way of doing things, since "Mädchen" is neuter? I'm assuming that if this story were told today, the word "ihr" would be used instead. Is that correct?
Using "ihm" referring to Mädchen is grammatically correct. Since it is neuter, there is a discrepancy between the biological gender and the grammatical gender. It is true that nowadays some people prefer to use the biological gender, although strictly speaking, that is grammically incorrect.
There are similar examples, e.g. die männliche Geisel, die männliche Person, die männliche Schildwache, das Männchen, which have the same discrepancy.
Ihm is correct. E.g. Das Mädchen war müde. Es ging ihm nicht gut.
I only partly agree with MadBaChi that it is derogative - it can be (for example if the girl is rather a young woman), but in this case it is already the use of Mädchen that would be problematic, not the use of es/ihm. It's grammatically wrong to use sie with Mädchen (neuter).
As a native speaker, I agree that using the (grammatically correct) "ihm" sounds a bit stiff or old fashioned. It's more common to use feminine pronouns, and it's not necessarily grammatically wrong, just imagine that the pronoun doesn't refer to the noun Mädchen, but rather to the person implied by that noun. Sie nahmen ihr ihre Kleider weg, zogen ihr einen Kittel an etc... sounds perfectly fine, and less old-fashioned (and less fairy tale-y)
All of the answers here are true in a way. From a purely grammatical standpoint, bduderstadt and Cythra are closest. If the subject of your sentence is neuter, you should use the pronouns accordingly. Using "der" instead of "dem" in a sentence like "das Mädchen, dem das Fahrrad geklaut wurde..." (the girl whose bike was stolen) would simply be wrong and also be perceived as wrong by native speakers.
However, German is a language, not a science. There are few ironclad rules and exceptions make life more interesting. If you can bite your way through a Grimm fairytale, you can read a modern day news article and I'd encourage you to read THIS about this very topic. It's not very long, but if you really want to skip ahead, the second to last paragraph is the one that actually deals with the grammar.
As for the story, while the use of the neuter gender in "Aschenputtel" is absolutely grammatically correct, it's also a stylistic choice. If the Grimm Brothers would have wanted to call her "sie", there would have been a million ways to do it, but by keeping the neuter gender all the way through, they were also underlining the fact that she is nothing but a little servant girl and is only an "it" to the people around her.
Look at "Dornröschen" (Sleeping Beauty) for a comparison. Despite nouns like "das Kind"/"das Mädchen"/"das Dornröschen" (being neuter because of the diminutive ending) cropping up, she's called "sie" through most of the story and at a few points the pronouns change even without a change of the subject noun:
""Was ist das für ein Ding, das so lustig herumspringt?" sprach das Mädchen, nahm die Spindel und wollte auch spinnen. Kaum hatte sie aber die Spindel angerührt so ging der Zauberspruch in Erfüllung, und sie stach sich damit in den Finger. "
It's mostly a matter of opinion. If you're unsure what to use though, err on the side of caution and go with the grammatical gender in writing at least. Spoken language is an entirely different thing and a lot more forgiving anyway :)
Can you post an example? I read over the story but found no sentence where the girl is referred to as "ihm". In the story, sometimes the girl is referred to as "es" because of "das Mädchen".
See: "Abends, wenn es (referring to the girl) sich müde gearbeitet hatte, kam es in kein Bett, sondern mußte sich neben den Herd in die Asche legen."
Which is correct, but sounds a little old fashioned. Today we would use "sie" instead of "es" ("es" sounds a bit derogative).
Edit: Sorry, just found the sentence you are probably referring to.
"Sie nahmen ihm seine schönen Kleider weg, zogen ihm einen grauen alten Kittel an, und gaben ihm hölzerne Schuhe."
Yes, here "ihm" refers to the girl. And once again, it is because of "das Mädchen" (neuter), which would be "dem Mädchen" or "ihm" in the Dativ. But since it is also referring to a female, it is also correct and more common to say "ihr".
Hope that helps. And yes, german is a bit strange, so feel free to ask if anything remains unclear. ;)