Spatial variations of the main field give rise to artifacts in magnetic resonance images if disregarded in reconstruction. With non-Cartesian k-space sampling, they often lead to unacceptable blurring. Data from such acquisitions are usually reconstructed with gridding methods and optionally restored with various correction methods. Both types of methods essentially face the same basic problem of adequately approximating an exponential function to enable an efficient processing with fast Fourier transforms. Nevertheless, they have commonly addressed it differently so far. In the present work, a unified approach is pursued. The principle behind gridding methods is first generalized to nonequispaced sampling in both domains and then applied to field inhomogeneity correction. Three new algorithms, which are compatible with a direct conjugate phase and an iterative algebraic reconstruction, are derived in this way from a straightforward embedding of the data into a higher dimensional space. Their evaluation in simulations and phantom experiments with spiral k-space sampling shows that one of them promises to provide a favorable compromise between fidelity and complexity compared with existing algorithms. Moreover, it allows a simple choice of key parameters involved in approximating an exponential function and a balance between the accuracy of reconstruction and correction.