Repository: deno
Issue: jupyter kernel crashes with korean characters almost at the end of the cell
Labels: bug,deno jupyter

### Reproducible steps

Environment: macOS Sonoma 14.4

1. Install latest deno.
2. Run `deno jupyter --install` in the terminal.
3. Open vscode and install deno vscode extension.
4. Open command palette(Cmd+Shift+P) and `Create: New Jupyter Notebook`.
5. Open command palette(Cmd+Shift+P) and `Notebook: Select Notebook Kernel`, and select deno.
6. Select the cell with <kbd>Enter</kbd>.
7. Input with Korean IME `ㅠ`, <kbd>Space</kbd>, <kbd>←</kbd> in sequence.

### Expected behavior

No crash happens.

### Actual behavior

```
22:19:18.872 [info] Handle Execution of Cells 1 for ~/Documents/sample.ipynb
22:19:18.877 [info] Kernel acknowledged execution of cell 1 @ 1709817558876
22:19:18.885 [info] End cell 1 execution after 0.008s, completed @ 1709817558884, started @ 1709817558876
22:19:41.088 [info] Handle Execution of Cells 1 for ~/Documents/sample.ipynb
22:19:41.094 [info] Kernel acknowledged execution of cell 1 @ 1709817581094
22:19:41.102 [info] End cell 1 execution after 0.008s, completed @ 1709817581102, started @ 1709817581094
22:31:07.597 [warn] StdErr from Kernel Process Unrecognized shell message type: inspect_request
22:31:08.061 [info] Too many pending requests 1 for kernel 3e4d70c4-2c66-4e4e-a2b2-2957e06b90ac, waiting for it to be ready.
22:31:08.259 [info] Too many pending requests 1 for kernel 3e4d70c4-2c66-4e4e-a2b2-2957e06b90ac, waiting for it to be ready.
22:31:08.348 [info] Too many pending requests 1 for kernel 3e4d70c4-2c66-4e4e-a2b2-2957e06b90ac, waiting for it to be ready.
22:31:09.228 [info] Too many pending requests 1 for kernel 3e4d70c4-2c66-4e4e-a2b2-2957e06b90ac, waiting for it to be ready.
22:31:30.722 [info] Too many pending requests 1 for kernel 3e4d70c4-2c66-4e4e-a2b2-2957e06b90ac, waiting for it to be ready.
22:31:30.811 [info] Too many pending requests 1 for kernel 3e4d70c4-2c66-4e4e-a2b2-2957e06b90ac, waiting for it to be ready.
22:35:08.815 [warn] StdErr from Kernel Process ============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.41.1
Args: ["~/.asdf/installs/deno/1.41.1/bin/deno", "jupyter", "--kernel", "--conn", "~/Library/Jupyter/runtime/kernel-v2-43528NrdzWLxteu5K.json"]
22:35:08.815 [warn] StdErr from Kernel Process thread 'main' panicked at cli/tools/jupyter/server.rs:575:19:
byte index 83 is not a char boundary; it is inside '서' (bytes 82..85) of `function getLunchPlace(me) {
  '서';
}

ge`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
22:35:08.820 [error] Disposing session as kernel process died ExitCode: 1, Reason: [0m[33mWarning[0m "deno jupyter" is unstable and might change in the future.
Unrecognized shell message type: inspect_request

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.41.1
Args: ["~/.asdf/installs/deno/1.41.1/bin/deno", "jupyter", "--kernel", "--conn", "~/Library/Jupyter/runtime/kernel-v2-43528NrdzWLxteu5K.json"]

thread 'main' panicked at cli/tools/jupyter/server.rs:575:19:
byte index 83 is not a char boundary; it is inside '서' (bytes 82..85) of `function getLunchPlace(me) {
  '서';
}

ge`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

22:35:08.820 [info] Dispose Kernel process 54711.
22:35:08.852 [info] End cell 1 execution after 0s, completed @ undefined, started @ undefined
```