[en] The emittance compensation technology will be used on the photo-cathode RF gun for Shanghai SDUV-FEL. The space charge force and its effect on electron beam transverse emittance in RF gun is studied, the principle of emittance compensation in phase-space is discussed. The authors have designed a compensation solenoid and calculated its magnetic field distribution. Its performance has been studied by the code PARMELA. A simulation result indicates that the normalized transverse RMS emittance for electron beam of 1.5 nC is 1.612 π mm·mrad, electron energy E = 5.71 MeV