Idk, if it was me i would keep not cutting my hair out of pure spite and see, what they gonna do. Maybe even double down on the shit and start doing something else, they wouldn't be fond of. Like, what are they gonna do, kick you out of school? Are they allowed to, tho? All the government-mandated codes should be available online you could read through those. But it should honestly be their business. Tell them you won't cut your hair, unless they point at a specific regulation that allows them to force you to.
Tho if your parents aren't on your side, that might be challenging. The alternative is to push the boundaries, say, only cut the off, like, one centimeter of hair(it will grow back in two weeks or so)