def get_location_by_offset(filename, offset):
    """
    This function returns the line and column number in the given file which
    is located at the given offset (i.e. number of characters including new
    line characters).
    """
    with open(filename, encoding='utf-8', errors='ignore') as f:
        for row, line in enumerate(f, 1):
            length = len(line)
            if length < offset:
                offset -= length
            else:
                return row, offset + 1