I just got a gem that grants +25% experience. Will it apply to the exp I get to level up, or only to the exp for mastering the weapon?
You don't directly earn XP. Instead, the XP any item you have equipped earn translates directly to your XP. If all of the items equipped are mastered, you gain 0 XP from a battle.
I can't prove this, but my assumption is that you would get a 25% bonus to the final XP tally after a fight.
There isn't technically a thing as Weapon or Character XP. There is just one amount of XP you get from a fight (Your XP bonus gem would increase this). That XP is then cut into five equal parts (one for each piece of equipment). Those five parts then attempt to contribute to your equipment's mastery level.
A lot of people don't seem to understand how XP really works in this game so I will try to explain it the best I can. Any XP applied to your equipment, is also applied to your character. The number that is split into 5 parts is basically the maximum you will receive and how much of it you get depends on your equipment's mastery level.
For example, lets say you have all brand-new equipment that has no mastery on it whatsoever. You gain 1,000 XP at the end of a fight. With your 25% XP bonus gem, this would increase the amount to 1,250 XP (You do not actually see the XP go up like this). The XP is split into 5 parts of 250 XP per equipment. Each piece of equipment will absorb that 250 XP for it's mastery and at the same time will boost your character level. at the end of this fight your character would get the full 1,000 XP because none of your weapon's were mastered yet.
If a weapon already has mastery but not completely filled yet, it needs lets say 100 XP to get to full mastery, the 100 XP will be absorbed by the weapon and boost your character level. The other 100 XP is lost and basically goes away. If the other four items received all 250 XP then you would gain 1100 XP from the fight.
If a weapon is completely mastered (meaning you already received the skill point from it), then it absorbs none of that 250 XP and it all is thrown away, not benefiting you or the equipment.
Because of all this, it is important to try and only use equipment that has not been mastered yet so you can get the XP after a fight and use it to level up, instead of it being wasted.